3
votes

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

1

1 Answers

3
votes

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)