开发者

How to push a modal view from didFinishPickingMediaWithInfo

I've开发者_高级运维 got an imagePickerController which allows the user to take or select an image. In - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info; I would like to trigger opening another modal view to capture the caption. I have a call for that purpose...

-(void) getcaption:(id) obj {
    textInput * ti = [[textInput alloc] initWithContent:@"" header:@"Caption for photo" source:2];
    ti.delegate = self;
    [self presentModalViewController:ti animated:YES];
    [ti release];

}

The question is how to call getcaption without triggering a spiral of

#6663 0x324abb18 in -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:] ()

At the moment I do

[self performSelector:@selector(getcaption:)  withObject:nil afterDelay:(NSTimeInterval)1];

in didFinishPickingMediaWithInfo which is nasty, and only 95% reliable


I assume the problem is that you are attempting to show your new view before your old view has closed? I assume you are in a parent view controller that is displaying both modal views with it being the parent. If that is the case, the point at which you should display the new modal view is when the parent view has completely finished hiding the previous modal view. Specifically, this happens at

- (void) viewDidAppear:(BOOL)animated

You'll want to make sure that you only show the second modal view after the previous one has finished, of course (that is, don't show it when the parent view is appearing for any other reason)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜