iOS面试

1.给UIview添加背景图片最简单方法

[self.view setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"11.jpg"]]];

2.iOS 获取UIWebView上面的按钮点击事件

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
//判断是否是单击
    if (navigationType == UIWebViewNavigationTypeLinkClicked)
    {
        NSURL *url = [request URL];
        if([[UIApplication sharedApplication]canOpenURL:url])
        {
            [[UIApplication sharedApplication]openURL:url];
        }
        return NO;
    }
    return YES;
}

你可能感兴趣的:(iOS面试)