实现点击UIWebView中链接调用Safari打开目标链接
-(BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType;
{
NSURL *requestURL =[ [ request URL ] retain ];
if ( ( [ [ requestURL scheme ] isEqualToString: @”http” ] || [ [ requestURLscheme ] isEqualToString: @”https” ] || [ [ requestURL scheme ]isEqualToString: @”mailto” ])
&& ( navigationType == UIWebViewNavigationTypeLinkClicked ) ) {
return ![ [ UIApplication sharedApplication ] openURL: [ requestURL autorelease] ];
}
[ requestURL release ];
return YES;
}
点击cell里面的一个按钮如何确定按钮所在的cell的行
在设置的BUTTON的selector的方法中如下设置:
- (void)pressed:(id)sender {
UITableViewCell * cell = (UITableViewCell *)[[sender superview] superview];
NSIndexPath * path = [self.tableView indexPathForCell:cell];
NSLog(@”index row%d”, [path row]);
//NSLog(@”view:%@”, [[[sender superview] superview] description]);
}
- (void)pressed:(id)sender;方法是我设置的button的selector