小编Oua*_*den的帖子

在解除modalviewcontroller后调用viewwillappear

viewwillappear解雇后如何打电话modalviewcontroller

有任何想法,因为在解雇后我viewwillappear没有被称为:

以模态方式呈现我的viewcontroller:// firsviewcontroller:

-(IBAction)AddActivity:(id)sender{


    CreateActivity *addViewController = [[CreateActivity alloc] initWithNibName:@"CreateActivity" bundle:nil];

    addViewController.delegate = self;
    addViewController.modalPresentationStyle = UIModalPresentationFormSheet;

    addViewController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;

    [self presentModalViewController:addViewController animated:YES];


    addViewController.view.superview.frame = CGRectMake(50, 260, 680, 624);

}
Run Code Online (Sandbox Code Playgroud)

// secondvioewcontroller:我创建了一个alertview来解除这个模态视图,但是没有调用viewwillapear:

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
    if (buttonIndex == 0){


        if ([self respondsToSelector:@selector(presentingViewController)]){
            [self.presentingViewController dismissModalViewControllerAnimated:YES];
        }
        else {
            [self.parentViewController dismissModalViewControllerAnimated:YES];
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

iphone objective-c ios

26
推荐指数
2
解决办法
2万
查看次数

在解雇modalviewwontroller后没有调用Viewwillappear

在我firstviewcontroller提出的一个modalviewcontroller,然后通过一个动作,我调用一个方法,显示一个警报并解雇modalview,但当它消失时,viewWillAppear不会被调用:

firstviewcontroller

-(IBAction)AddActivity:(id)sender{


    CreateActivity *addViewController = [[CreateActivity alloc] initWithNibName:@"CreateActivity" bundle:nil];

    addViewController.delegate = self;
    addViewController.modalPresentationStyle = UIModalPresentationFormSheet;

    addViewController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;

    [self presentModalViewController:addViewController animated:YES];


    addViewController.view.superview.frame = CGRectMake(50, 260, 680, 624);

}
//in secondviewcontroller I use an alert view that call this method in order to dismiss modalview

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
    if (buttonIndex == 0){


        if ([self respondsToSelector:@selector(presentingViewController)]){
            [self.presentingViewController dismissModalViewControllerAnimated:YES];
        }
        else {
            [self.parentViewController dismissModalViewControllerAnimated:YES];
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

当它消失,viewWillAppear不被称为,我想要的是什么

objective-c uiviewcontroller ios

1
推荐指数
1
解决办法
4317
查看次数

标签 统计

ios ×2

objective-c ×2

iphone ×1

uiviewcontroller ×1