iPhone:在 uitableview 顶部显示 uiview 时出现问题
我试图在 uitableview 之上显示一个 webview,我在 Nib 中设计了视图,但我做了一些严重错误的事情,它根本不起作用。
在 uitableview 控制器中我这样做;
modalWebView *webUIViewController = [[modalWebView alloc] init];
NSArray* s=[[NSBundle mainBundle] loadNibNamed:@"modalWebView" owner:webUIViewController options:nil];
UIView* v= [s objectAtIndex:0];
[self showModal:v];
这就是方法;
- (void) showModal:(UIView*) modalView {
UIWindow* mainWindow = (((AppDelegate_iPhone*) [UIApplication sharedApplication].delegate).window);
CGSize offSize = [UIScreen mainScreen].bounds.size;
CGPoint offScreenCenter = CGPointMake(offSize.width / 2.0, offSize.height * 1.5);
modalView.center = offScreenCenter; // we start off-screen
[mainWindow addSubview:modalView];
modalView.center=middleCenter;
}
I am trying to show a webview on top of the uitableview, I designed the view in Nib, but I am doing something seriously wrong and it does not work at all..
In the uitableview controller I do this;
modalWebView *webUIViewController = [[modalWebView alloc] init];
NSArray* s=[[NSBundle mainBundle] loadNibNamed:@"modalWebView" owner:webUIViewController options:nil];
UIView* v= [s objectAtIndex:0];
[self showModal:v];
And this is the method;
- (void) showModal:(UIView*) modalView {
UIWindow* mainWindow = (((AppDelegate_iPhone*) [UIApplication sharedApplication].delegate).window);
CGSize offSize = [UIScreen mainScreen].bounds.size;
CGPoint offScreenCenter = CGPointMake(offSize.width / 2.0, offSize.height * 1.5);
modalView.center = offScreenCenter; // we start off-screen
[mainWindow addSubview:modalView];
modalView.center=middleCenter;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看看我是如何做到这一点的:
我希望它对你有帮助!
Look how I accomplished that:
I hope it helps you!
请访问下面的链接,希望这对您展示您的观点有所帮助。
如何加载使用 Interface Builder 创建的 nib 文件的 UIView
Please visit the link below, I hope this will help you out to display your view.
How to load a UIView using a nib file created with Interface Builder