在我的通用应用程序中,我试图在uialertsheet中显示webview,但得到奇怪的结果,为什么webview向左移动?和ok按钮在顶部?我想只是居中并且非常适合于uisheet窗口,但是可以点击底部的
您也可以简单地忽略我的代码,并告诉我们如何实现这一目标。
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];
答案 0 :(得分:0)