IOS: NSMutableArray in Viewdidload?

Try this instead: if (i Initializing it in viewDidLoad seems right. You may need to add some "protection" (as above) in your table methods to avoid accessing an empty array. Then in method like viewWillAppear: call reloadData.

Try this instead: if (i Why your array is turning up empty is another issue. Initializing it in viewDidLoad seems right. You may need to add some "protection" (as above) in your table methods to avoid accessing an empty array.

Then in method like viewWillAppear:, call reloadData.

I try but it dont' work. If I use an array of string it work well, but it don't work with an array of UIViewImage...why? – blackguardian Apr 13 at 16:32 How are you creating the images you are putting into the array?

Perhaps they are getting released behind your back. But I would not then expect the array to be empty. Rather, if that were happening, the array would contain references to objects that no longer exist, which would cause a crash eventually when you tried to access those objects.

– MarkGranoff Apr 13 at 16:35 IBOutlet UIImageView *image1, *image2, *image3; (in . H) – blackguardian Apr 13 at 16:38 after I put the image in the array in this mode : image1 = arrayView objectAtIndex:0; (in viewdidload) – blackguardian Apr 13 at 16:42 Oh. So the images are outlets connected with your view.

Aha! I bet image1, et al are nil at the point at which you are adding them to your array. So, you are not adding anything to the array, which explains why the array is empty in cellForRowAtIndexPath.

Double check that your outlets are actually connected to the view elements. You may need to initialize this array in viewWillAppear: because at that point, the outlets should definitely be available for use. – MarkGranoff Apr 13 at 16:44.

Please post the rest of viewDidLoad. I want to see how image1 is initialized. The line: arrayView = NSMutableArray alloc initWithObjects: image1, image2, image3, nil; will return an empty array if image1 is nil.

You should also protect your app from crashing by not making assumptions about the data source. You shouldn't crash if the array is empty, just display an empty tableView. EDIT I just read the last comment you made in the other answer.

Sounds like your imageViews are created in IB. Make sure they are connected to the image1 etc outlets in IB.

Please post the rest of viewDidLoad. I want to see how image1 is initialized. Will return an empty array if image1 is nil.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions