简体   繁体   中英

Dismiss subView

I have such a code in FirstViewController

{
SecondViewController *objComing=[[SecondViewController alloc] init];
[self.view addSubview:objComing.view];

objComing.view.backgroundColor=[UIColor blueColor];

objComing.view.frame=CGRectMake(0,420, 320, 0);
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.5];

[UIView setAnimationCurve:UIViewAnimationCurveEaseIn];
objComing.view.frame=CGRectMake(0,0, 320, 420);

[UIView commitAnimations];
}

SecoundViewController contains button to close/dismiss. How should look the IBAction connected to button (included in SecoundViewController) to dismiss/remove and hide this overlayer?

在“关闭/关闭”按钮方法中,添加以下行以删除secondviewcontroller子视图:

[self.view removeFromSuperview];

[self.view removeFromSuperview];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM