开发者

Problem with sending data to Modal View Controller on iPhone

So I've got one main view with some images on it, and when someone touches one of the images, the image will return an ID number to this main view and then this view will present a modal view controller to display a larger version of this image. But the current way I'm doing it, the function on the modal controller is getting there before the NIB is loaded or something, because when (in that function) i tell it to change the text of some IB labels they are NULL. However, when I, say, press a button that calls a function to do the same it does it just fine. Here's what I'm doing now:

What is the best way to send data to a modal view controller while presenting it? Thanks so much!

- (void)photoViewWasTouchedWithID:(int)imgID {

[self presentModalViewController:singlePhotoView animated:YES];
[singlePhotoView showImageWithID:imgID];

开发者_如何学编程}


Instead of doing the view object manipulation in showImageWithID:, store the parameter into a member variable. Then do your setup work in viewWillAppear, and your view objects should be instantiated.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜