views:

56

answers:

1

Bottom line is, I've been working on an app, and it seems that if I place a UIAlert in viewDidLoad, it gets called twice (from a delegate method of UIImagePickerController). If I put it in viewDidAppear, it gets called once.

I've looked through documentation but it just confuses me. Can someone explain it to me? Thank you.

+1  A: 

A UIView object can get loading into memory and release multiple times without ever getting added to the view stack and appearing on the display.

My guess is that you have 2 references to this view (maybe one in a nib file?), so it's getting loaded, then released when the second reference is loaded and assigned to the same property, then only the latter gets added to the view stack. You can see this by printing out (NSLog) the integer value of self ("%ld",(long int)self) in the viewDidLoad and viewDidAppear methods.

hotpaw2