1.调用代码使APP进入后台,达到点击home键的效果
[[UIApplication sharedApplication] performSelector:@selector(suspend)];
2.带有中文URL处理
http://static.tripbe.com/videofiles/视频/我的文档.mp4
NSString *path = (__bridge_transfer NSString *)CFURLCreateStringByReplacingPercentEscapesUsingEncoding(NULL, (__bridge CFStringRef)model.mp4_url, CFSTR(""), CFStringConvertNSStringEncodingToEncoding(NSUTF8StringEncoding));
3.获取WebView的高度
- (void)webViewDidFinishLoad:(UIWebView *)webView {
CGFloat height = [[webView stringByEvaluatingJavaScriptFromString:@"document.body.offsetHeight"] floatValue];
CGRect frame = webView.frame;
webView.frame = CGRectMake(frame.origin.x, frame.origin.y, frame.size.width, height);
}
4.给UIView设置图片(UILable也可以)
给UIView设置图片(UILabel一样适用)
第一种方法:
利用的UIView的设置背景颜色方法,用图片做图案颜色,然后传给背景颜色。
UIColor *bgColor = [UIColor colorWithPatternImage: [UIImage imageNamed:@"bgImg.png"];
UIView *myView = [[UIView alloc] initWithFrame:CGRectMake(0,0,320,480)];
[myView setBackGroundColor:bgColor];
第二种方法:
UIImage *image = [UIImage imageNamed:@"[email protected]"];
yourView.layer.contents = (__bridge id)image.CGImage;
//设置显示的图片范围
yourView.layer.contentsCenter = CGRectMake(0.25,0.25,0.5,0.5);//四个值在0-1之间,对应的为x,y,width,height
5.去掉UITableView多余的分割线
MyTableView.tableFooterView = [UIView new];
6.收起键盘UITableView、ScrollView
yourTableView.keyboardDismissMode = UIScrollViewKeyboardDismissModeOnDrag
UIScrollViewKeyboardDismissModeInteractive,表示在键盘内部滑动,键盘逐渐下去
7.bringSubviewToFront 将指定视图推到前面 sendSubviewToBack将指定视图推到背面
[self.view.window sendSubviewToBack:self.view];