I am presenting a modalcontroller in a view, after i dissmiss the view i want to present another modalView but the code is not working, i have a delegate method that is being called when i press a button on the first modal vieview in witch i have the code.
inside the parentView the method for the firstview delegat:
-(void)newMessageModalView:(NewMessageModalView *)controller didFinishSelecting:(int)selectedChannel{
[self dismissModalViewControllerAnimated:YES];
SecondView * detailView = [[SecondView alloc] initWithNibName:@"SecondView" bundle:nil];开发者_JAVA技巧
[self presentModalViewController:SecondView animated:YES];
[detailView release];
[self dismissModalViewControllerAnimated:YES];
}
You are presenting SecondView, which is your class and not your instance. Even if that was right, you are dismissing it straight away.
Move [self dismissModalViewControllerAnimated:YES]; to detailView.m
-(void)newMessageModalView:(NewMessageModalView *)controller didFinishSelecting:(int)selectedChannel{
SecondView * detailView = [[SecondView alloc] initWithNibName:@"SecondView" bundle:nil];
[self presentModalViewController:SecondView animated:YES];
[detailView release];
}
For example, in detailView.m
- (void)cancelBtnTouched:(id)sender {
[self dismissModalViewControllerAnimated:YES];
}
精彩评论