[英]iPhone: showing UIWebview in UIActionSheet problem
In my universal app I am trying to show webview in a uialertsheet but getting weird results, why is that webview shifted on left? 在我的通用应用程序中,我试图在uialertsheet中显示Webview,但结果却很奇怪,为什么Webview向左移动? and ok button is on the top?
确定按钮在顶部? I want to just center and nicely fit to the uisheet window but with the OK button clickable on the bottom
我只想居中并很好地适合uisheet窗口,但可以单击底部的“确定”按钮
You can also simply ignore my code and may tell how to accomplish this. 您也可以简单地忽略我的代码,并告诉您如何完成此操作。
tnx n
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];
I solved the problem easily simply by reading this article; 通过阅读本文,我轻松解决了这个问题;
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CocoaViewsGuide/Coordinates/Coordinates.html http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CocoaViewsGuide/Coordinates/Coordinates.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.