我试图在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;
}
答案 0 :(得分:1)
看看我是如何完成的:
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]];
我希望它可以帮到你!
答案 1 :(得分:0)
请访问以下链接,我希望这可以帮助您显示您的观点。
How to load a UIView using a nib file created with Interface Builder