ios经验总结

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"];

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值