Xcode: How To Create A PopUp View Controller That Appears In Another View Controller

后端 未结 7 536
-上瘾入骨i
-上瘾入骨i 2021-01-31 12:27

Basically what I am trying to figure out to do is, say I have one View Controller, called V1, that has a regular view inside it and a button. Now, when you tap that button, I wa

相关标签:
7条回答
  • 2021-01-31 12:58

    You can create such view by setting appropriate property type of modalPresentationStyle. See my example below:

    UIViewController *V2 = [[UIViewController alloc] init];
    V2.modalPresentationStyle = UIModalPresentationFormSheet;
    V2.modalTransitionStyle = UIModalTransitionStyleCoverVertical;     
    [V1 presentViewController:V2 animated:YES completion:nil];
    V2.view.superview.frame = CGRectMake(0, 0, 540, 620); //it's important to do this after presentModalViewController
    V2.view.superview.center = V1.view.center;
    [V1 release];
    
    0 讨论(0)
提交回复
热议问题