須要注意的是須要獲取原來的UIWebView的User-Agent,而後拼接上本身新的User-Agent,貌似直接替換原來的無效,另外,修改User-Agent以後從新建立UIWebView加載網頁web
// 修改uaui
UIWebView* tempWebView = [[UIWebViewalloc] initWithFrame:CGRectZero];lua
NSString* userAgent = [tempWebViewstringByEvaluatingJavaScriptFromString:@"navigator.userAgent"];orm
NSString *ua = [NSStringstringWithFormat:@"%@\\%@",ip
userAgent,string
@" / ZhuShou Browser"];it
[[NSUserDefaultsstandardUserDefaults] registerDefaults:@{@"UserAgent" : ua,@"User-Agent" : ua}];io
NSMutableURLRequest *request =[NSMutableURLRequestrequestWithURL:[NSURLURLWithString:myBxd(self.uid)]];table
web = [[UIWebViewalloc] init];request
web.frame = CGRectMake(0, navHeight, ApplicationScreenWidth,ApplicationScreenHeight - navHeight);
[web loadRequest:request];
web.delegate = self;
[websizeToFit];
[self.viewaddSubview:web];