我不知道如何实现,但下面的图片显示了我想要显示模式的大小:调整大小模态的视图
我用来推模式视图代码:
CustomerLogin *customerlogin = [[CustomerLogin alloc] initWithNibName:@"CustomerLogin" bundle:nil];
[self presentModalViewController:customerlogin animated:YES];
[customerlogin release];
编辑---
低于建议做出改变这个样子:
UIView *overlay = [[UIView alloc] initWithFrame:self.view.bounds];
overlay.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5]; // Black color
[self.navigationController.view addSubview:overlay];
//Add Login View
CustomerLogin *loginView = [[CustomerLogin alloc] initWithFrame:CGRectMake(0,0, 200, 300)]; //I guessed a size
loginView.center = overlay.center; //Center the view
[overlay addSubview:loginView];
获得3个错误:
物业中心不处于CustomerLogin 存在CustomerLogin不会响应initWithFrame 不兼容的指针类型发送CustomerLogin *键入的UIView *
向我展示您的CustomerLogin视图/ xib屏幕,对象必须位于中心。背景颜色是黑色的alpha = 0.3 – vishy 2012-04-26 13:21:36
它不起作用,因为你的客户登录是UIViewController的子类,对吧?如果是的话,你必须使用Jason McTaggart代码,但这不是最好的方法。 – bontoJR 2012-04-27 08:02:35