简体   繁体   English

iPhone:在顶部uitableview上显示uiview时出现问题

[英]iPhone: Problem with showing uiview on top uitableview

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.. 我试图在uitableview上显示一个webview,我在Nib中设计了该视图,但是我做的事情很不对劲,根本无法使用。

In the uitableview controller I do this; 我在uitableview控制器中执行此操作;

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;
}

Look how I accomplished that: 看看我是如何做到的:

StatusChangedMsgView *temp = [[StatusChangedMsgView alloc] initWithFrame:CGRectMake(10, 66, 300, 35)];  
XUIAppDelegate *delegate = (XUIAppDelegate*)[UIApplication sharedApplication].delegate;
[delegate.window insertSubview:temp atIndex:[[delegate.window subviews]count]];

I hope it helps you! 希望对您有帮助!

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 如何使用通过Interface Builder创建的nib文件加载UIView

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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