我已经尝试了所有我能想到的让我的 UIWebView 在 Iphone 4、5 和 Ipad 上自动填充屏幕的方法。我使用了自动调整大小的蒙版,尝试根据设备以编程方式设置框架,但仍然注意到有效。
这不是加载的 HTML 的缩放问题,滚动条实际上不在它们应该在的位置。
我究竟做错了什么?我知道这不应该这么难。
@interface webview ()
@end
@implementation webview
@synthesize weber;
@synthesize suppressesIncrementalRendering;
static NSString* titled;
static NSString* urlholder;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
-(void)viewWillAppear:(BOOL)animated
{
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
}
-(void)viewDidDisappear:(BOOL)animated
{
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
}
- (void)viewDidLoad
{
[super viewDidLoad];
self.weber.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
self.title= titled;
NSString *fullURL = urlholder;
NSURL *url = [NSURL URLWithString:fullURL];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[weber setSuppressesIncrementalRendering:YES];
[weber loadRequest:requestObj];
wasLoaded = NO;
alertWasShown = NO;
weber.delegate = self;
}
- (void)webViewDidStartLoad:(UIWebView *)webView {
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
}
- (void)webViewDidFinishLoad:(UIWebView *)webView {
wasLoaded = YES; // Indicates that it finished loading.
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
}
-(void) setttl: (NSString*) titler
{
titled= titler;
}
-(void) setURL: (NSString*) url
{
urlholder= url;
}