1.当一个控制器的View是另一控制器view的子控件,那么这个控制器也最好也是另一个控制器的子控制器例如:
UIViewController *testVC = [UIViewController new];
[self.view addSubview:testVC.view];
[self addChildViewController:testVC];
2.- (void)viewDidLayoutSubviews屏幕旋转就会调用
3.UIGraphicsBeginImageContextWithOptions(_headerView.frame.size, _headerView.opaque, 0.0);
[_headerView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage * viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();全屏截图
4.webview禁止用户选择跟长按
- (void)webViewDidFinishLoad:(UIWebView *)webView {
// 禁用用户选择
[webView stringByEvaluatingJavaScriptFromString:@"document.documentElement.style.webkitUserSelect='none';"];
// 禁用长按弹出框
[webView stringByEvaluatingJavaScriptFromString:@"document.documentElement.style.webkitTouchCallout='none';"];
}
5.https://developer.apple.com/appstore/contact/?topic=expedite快速审核
6.NSIndexPath类型是用来获取用户选择的indexPath,在别的函数里面,若需要知道用户选择了哪个cell,用上它可以省事很多。不必再去建全局变量section和row。
NSIndexPath *tableSelection = [self.tableView indexPathForSelectedRow];
7.点击home键触发AppDelegate.m中的
- (void)applicationWillResignActive:(UIApplication *)application
8.禁止锁屏
[UIApplication sharedApplication].idleTimerDisabled = YES;
或
[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
9.修改UITextField中Placeholder的文字颜色
[textField setValue:[UIColor redColor] forKeyPath:@"_placeholderLabel.textColor"];