iPhone:问题出在顶部的UITableView

问题描述:

我试图显示在UITableView的顶部网页视图的UIView,我设计笔尖的观点,但我做一些严重错误,并没有在所有的工作..iPhone:问题出在顶部的UITableView

在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

是否有任何理由,为什么你不只是显示视图 - 控制持有与'presentModalViewController' web视图? – rckoenes

+0

@rckoenes它覆盖了我不想要的整个屏幕 – Spring

+1

@XDeveloper将它添加到应用程序窗口的全部重点是它保持在一切之上。如果你只是想在表格视图的顶部添加它到视图控制器的视图'[self.view addSubview:v]'。但在此之前配置其大小和坐标。 –

请访问下面的链接,我希望这可以帮助你展示你的观点。

How to load a UIView using a nib file created with Interface Builder

+0

哪里是链接? – Spring

+0

喔对不起...这里是:http://stackoverflow.com/questions/863321/iphone-how-to-load-a-view-using-a-nib-file-created-with-interface-builder –

看怎么做到了这一点:

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

我希望它可以帮助你!

+0

TNN但这没有奏效我不为什么.. – Spring