Ios iPad应用程序modalpopup视图角颜色不正确。。。?
我正在开发iPad应用程序,有时我需要在IBAction上弹出视图。同样,我也正确地使用了下面的代码Ios iPad应用程序modalpopup视图角颜色不正确。。。?,ios,ipad,uiviewcontroller,uicolor,uimodalpresentationstyle,Ios,Ipad,Uiviewcontroller,Uicolor,Uimodalpresentationstyle,我正在开发iPad应用程序,有时我需要在IBAction上弹出视图。同样,我也正确地使用了下面的代码 SCSelection *vcSCSelection = [[SCSelection alloc]initWithNibName:@"SCSelection" bundle:Nil]; vcSCSelection.modalPresentationStyle = UIModalPresentationFormSheet; [self presentModalViewController:vcSC
SCSelection *vcSCSelection = [[SCSelection alloc]initWithNibName:@"SCSelection" bundle:Nil];
vcSCSelection.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentModalViewController:vcSCSelection animated:YES];
它工作正常,并显示了我的视图,该视图的大小为表单的。
我需要在此视图上应用一些背景自定义颜色,我在弹出视图的-(void)viewDidLoad方法中维护这些颜色,如下所示
self.view.backgroundColor = [UIColor colorWithRed:61/255.0 green:61/255.0 blue:61/255.0 alpha:1];
现在,我的问题是当弹出视图显示它被背景色覆盖时,除了下面的角。正如您可以发现的,有一些角落空间的颜色效果是不适用的。我只是用椭圆形突出它。
我怎样才能克服这个问题。我也遇到过类似的问题,下面是一篇关于我是如何做到这一点的评论。注意,此代码位于触发模态视图表示的视图控制器中
// Login Table View Controller
UITableViewController *loginPanel = (UITableViewController*) [mainStoryboard instantiateViewControllerWithIdentifier: @"LoginTVC"];
// Setup Login panel presentation style
loginPanel.modalPresentationStyle = UIModalPresentationFormSheet;
// Present Login Panel (called before view's bounds modifications so that it instantiates
[self presentViewController:loginPanel animated:YES completion:nil];
// ============================================
// Make form sheet's view slightly smaller or
// equal to the login panel's view so that corners
// don't have white color bleed.
// ============================================
// Set the bounds & clipping (very important) of the
// superview (which would be the formsheet's view
// when using UIModalPresentationFormSheet)
loginPanel.view.superview.bounds = CGRectMake(0, 0, 400, 380);
loginPanel.view.superview.layer.cornerRadius = 8.0f;
loginPanel.view.superview.clipsToBounds = YES;
// Set the bounds of the view being presented modally as UIModalPresentationFormSheet
loginPanel.view.bounds = CGRectMake(0, 0, 400, 380);