ios - NsmutableArray only show last object added at all index paths -
I'm stuck at a very low point. I want to show the dummy data table view from the array. But I always get only the last object on all the objects. I do not know why this is override by the last thing
- (NSMutableArray *) clubTypes {NSMutableArray * clubTypeDataArray = [[NSMutableArray alloc] init]; ClubTopDC * ClubTaps = [[ClubType DC Alok] Init]; // slideMenu_dataArray = [[NSMutableArray alloc] init]; ClubTypes.clubTypeID = 1; ClubTypes.clubTypeTitle = @ "Tonight"; ClubTypes.clubTypeImage = @ "icon_hot_tonight.png"; ClubTypes.clubTypeSelectedImage = @ "icon_hot_tonight_touch.png"; [Clubtopydata array add object: clubtaps]; ClubTypes.clubTypeID = 2; ClubTypes.clubTypeTitle = @ "Lounge"; ClubTypes.clubTypeImage = @ "icon_lounges.png"; ClubTypes.clubTypeSelectedImage = @ "icon_lounges_touch.png"; [Clubtopydata array add object: clubtaps]; ClubTypes.clubTypeID = 3; ClubTypes.clubTypeTitle = @ "Pub / Sports Bar"; ClubTypes.clubTypeImage = @ "icon_pubs.png"; ClubTypes.clubTypeSelectedImage = @ "icon_pubs_touch.png"; [Clubtopydata array add object: clubtaps]; ClubTypes.clubTypeID = 4; ClubTypes.clubTypeTitle = @ "Scissors Bar"; ClubTypes.clubTypeImage = @ "icon_shisha_bars.png"; ClubTypes.clubTypeSelectedImage = @ "icon_shisha_bars_touch.png"; [Clubtopydata array add object: clubtaps]; ClubTypes.clubTypeID = 5; ClubTypes.clubTypeTitle = @ "Ladies Night"; ClubTypes.clubTypeImage = @ "icon_ladies_night.png"; ClubTypes.clubTypeSelectedImage = @ "icon_ladies_night_touch.png"; [Clubtopydata array add object: clubtaps]; ClubTypes.clubTypeID = 6; ClubTypes.clubTypeTitle = @ "Music Festival"; ClubTypes.clubTypeImage = @ "icon_music_festivals.png"; ClubTypes.clubTypeSelectedImage = @ "icon_music_festivals_touch.png"; [Clubtopydata array add object: clubtaps]; ClubTypes.clubTypeID = 7; ClubTypes.clubTypeTitle = @ "boat parties"; ClubTypes.clubTypeImage = @ "icon_boat_parties.png"; ClubTypes.clubTypeSelectedImage = @ "icon_boat_parties_touch.png"; [Clubtopydata array add object: clubtaps]; ClubTypes.clubTypeID = 8; ClubTypes.clubTypeTitle = @ "Evening Brunch"; ClubTypes.clubTypeImage = @ "icon_evening_brunches.png"; ClubTypes.clubTypeSelectedImage = @ "icon_evening_brunches_touch.png"; [Clubtopydata array add object: clubtaps]; ClubTypes.clubTypeID = 9; ClubTypes.clubTypeTitle = @ "Beach / Details"; ClubTypes.clubTypeImage = @ "icon_beach_parties.png"; ClubTypes.clubTypeSelectedImage = @ "icon_beach_parties_touch.png"; [Clubtopydata array add object: clubtaps]; ClubTypes.clubTypeID = 10; ClubTypes.clubTypeTitle = @ "Configuration"; ClubTypes.clubTypeImage = @ "icon_configuration.png"; ClubTypes.clubTypeSelectedImage = @ "icon_configuration_touch.png"; [Clubtopydata array add object: clubtaps]; ClubTypes.clubTypeID = 11; ClubTypes.clubTypeTitle = @ "About Ungraded"; ClubTypes.clubTypeImage = @ "icon_about.png"; ClubTypes.clubTypeSelectedImage = @ "icon_about_touch.png"; [Clubtopydata array add object: clubtaps]; // [clubtopydata array add object: clubtaps]; Return ClubTypeDataAir; } Please help me where there is a problem.
Because you are not creating new objects, you can add the same object repeatedly and Keep modifying.
Do this instead:
- (NSMutableArray *) clubTypes {NSMutableArray * ClubTypeDataArere = [[NSMUTABARRRARRAAL] INST]; ClubTopDC * ClubTaps = [[ClubType DC Alok] Init]; // slideMenu_dataArray = [[NSMutableArray alloc] init]; ClubTypes.clubTypeID = 1; ClubTypes.clubTypeTitle = @ "Tonight"; ClubTypes.clubTypeImage = @ "icon_hot_tonight.png"; ClubTypes.clubTypeSelectedImage = @ "icon_hot_tonight_touch.png"; [Clubtopydata array add object: clubtaps]; ClubTypes = [[ClubType DC Alok] init]; ClubTypes.clubTypeID = 2; ClubTypes.clubTypeTitle = @ "Lounge"; ClubTypes.clubTypeImage = @ "icon_lounges.png"; ClubTypes.clubTypeSelectedImage = @ "icon_lounges_touch.png"; [Clubtopydata array add object: clubtaps]; ClubTypes = [[ClubType DC Alok] init]; ClubTypes.clubTypeID = 3; ClubTypes.clubTypeTitle = @ "Pub / Sports Bar"; ClubTypes.clubTypeImage = @ "icon_pubs.png"; ClubTypes.clubTypeSelectedImage = @ "icon_pubs_touch.png"; [Clubtopydata array add object: clubtaps]; ...}
Comments
Post a Comment