开发者

Why is presentModalViewController not working?

开发者 https://www.devze.com 2023-04-09 03:18 出处:网络
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 but

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];
}
0

精彩评论

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