0
在我的通用應用程序中,我試圖在uialertsheet中顯示webview,但得到奇怪的結果,爲什麼webview會左移?並確定按鈕是在頂部?我想只是居中,很適合uisheet窗口,但在底部點擊OK按鈕iPhone:在UIActionSheet問題中顯示UIWebview
您也可以簡單地忽略我的代碼,並告訴如何完成此操作。
TNX
UIActionSheet *msgSheet = [[[UIActionSheet alloc]
initWithTitle:@"x"
delegate:nil
cancelButtonTitle:nil destructiveButtonTitle:nil
otherButtonTitles:@"OK", nil]
autorelease];
UIWebView *w=[[UIWebView alloc] init];
[w loadHTMLString:theString baseURL:nil];
[msgSheet addSubview:w];
[w release];
[msgSheet showInView:self.view];
[msgSheet setOpaque:NO];
[msgSheet setAlpha:0.7];
CGRect wRect = msgSheet.bounds;
w.bounds = wRect;
CGRect menuRect = msgSheet.frame;
CGFloat orgHeight = menuRect.size.height;
menuRect.origin.y -= 150; //height of webview
menuRect.size.height = orgHeight+150;
msgSheet.frame = menuRect;
CGRect wRect = w.frame;
wRect.origin.y = orgHeight;
w.frame = wRect;
CGSize mySize = msgSheet.bounds.size;
CGRect myRect = CGRectMake(0, 0, mySize.width, mySize.height);
UIImageView *redView = [[[UIImageView alloc] initWithFrame:myRect] autorelease];
[blueView setBackgroundColor:[[UIColor APP_TINT_COLOR] colorWithAlphaComponent:0.6]];
[msgSheet insertSubview:blueView atIndex:0];