我在一个视图中呈现一个模态控制器,在我解除视图后我想呈现另一个modalView但代码不工作,我有一个委托方法,当我按下第一个模态视图中的按钮时被调用我有代码。
在parentView内部为firstview委托的方法:
-(void)newMessageModalView:(NewMessageModalView *)controller didFinishSelecting:(int)selectedChannel{
[self dismissModalViewControllerAnimated:YES];
SecondView * detailView = [[SecondView alloc] initWithNibName:@"SecondView" bundle:nil];
[self presentModalViewController:SecondView animated:YES];
[detailView release];
[self dismissModalViewControllerAnimated:YES];
}
答案 0 :(得分:2)
您正在呈现SecondView,这是您的类,而不是您的实例。即使这是对的,你也会马上解雇它。
答案 1 :(得分:0)
移动[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];
}
例如,在detailView.m
中- (void)cancelBtnTouched:(id)sender {
[self dismissModalViewControllerAnimated:YES];
}