OC版本
-(BOOL)webView:(UIWebView )webView shouldStartLoadWithRequest:(NSURLRequest )request navigationType:(UIWebViewNavigationType)navigationType { NSString *requeststr=request.mainDocumentURL.relativeString; if([requeststr rangeOfString:@”#”].location!=NSNotFound) { NSDictionary *data = [self requesParmeter:requeststr]; for (NSString *str in self.webStringArray) { if (![data.allKeys containsObject:@”do”]) return NO; // if ([requeststr rangeOfString:str].location != NSNotFound) { if ([data[@”do”] isEqualToString:str]) { [self performSelector:NSSelectorFromString([str stringByAppendingString:@”:”]) withObject:data]; return NO; } } } return YES; }
//初始化公用参数的数组 - (NSArray *)webStringArray { if (_webStringArray == nil) { _webStringArray = @[]; } return _webStringArray; }
新闻热点
疑难解答