1.iPhone 各屏幕尺寸整理
XR/11 414*896
XS Max/11 Pro Max 414*896
X/XS/11 Pro 375*812 pt
6P/6SP/7P/8P 414*736 pt
6/6S/7/8 375*667 pt
5/5S/5c/SE 320*568 pt
4/4s 320*480 pt
2.当某些页面状态栏颜色无法修改时,尝试以下方法
解决个别vc中状态栏字体颜色不同的办法
1、在info.plist中,将View controller-based status bar appearance设为NO.
2、在app delegate中:
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
1、在vc中重写vc的preferredStatusBarStyle方法
-(UIStatusBarStyle)preferredStatusBarStyle {
return UIStatusBarStyleLightContent;
}
2、在viewDidload中调用:
[self setNeedsStatusBarAppearanceUpdate];
3.修改系统相册 导航栏颜色 以及系统相册改为中文
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated{
if ([navigationController isKindOfClass:[UIImagePickerController class]]){ viewController.navigationController.navigationBar.translucent = NO;
viewController.edgesForExtendedLayout = UIRectEdgeNone;
viewController.navigationController.navigationBar.barTintColor = [UIColor whiteColor];
viewController.navigationController.navigationBar.tintColor = [UIColor blackColor];
//title颜色和字体
viewController.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName:R17Color,
NSFontAttributeName:[UIFont systemFontOfSize:18]};
}
}
//修改相机相册文字
Localization native development region ————》chinese
4.Xcode11 使用LaunchScreen.storyboard创建启动页
还需要在build setting asset catalog 里面写上
LaunchImage
5.错误排查
@try{
//代码写在这个里面
}
@catch(NSException *exception) {
NSLog(@"异常错误是:%@", exception);
}
@finally {
}
6.iOS 视图类写成弱引用
UIView *tableHeaderView = [[UIView alloc] initWithFrame:rect];
[self.view addSubView:tableHeaderView]; // 被self.view.subViews强引用
_tableHeaderView = tableHeaderView; // _tableHeaderView被弱引用
...
// 这样做是为了及时的释放tableHeaderView。当tableHeaderView不被self.view强引用时,指向它的只有weak指针,在内存中释放。
// 对于一个重要的视图或者即使从它的父视图remove,也不需要从内存释放,就不必用weak。使用weak修饰的视图建议不使用懒加载。
7.添加四边阴影效果
- (void)addShadowToView:(UIView *)theView withColor:(UIColor *)theColor {
// 阴影颜色
theView.layer.shadowColor = theColor.CGColor;
// 阴影偏移,默认(0, -3)
theView.layer.shadowOffset = CGSizeMake(0,0);
// 阴影透明度,默认0
theView.layer.shadowOpacity = 0.5;
// 阴影半径,默认3
theView.layer.shadowRadius = 5;
}
8. 添加单边阴影效果
- (void)addShadowToView:(UIView *)theView withColor:(UIColor *)theColor {
theView.layer.shadowColor = theColor.CGColor;
theView.layer.shadowOffset = CGSizeMake(0,0);
theView.layer.shadowOpacity = 0.5;
theView.layer.shadowRadius = 5;
// 单边阴影 顶边
float shadowPathWidth = theView.layer.shadowRadius;
CGRect shadowRect = CGRectMake(0, 0-shadowPathWidth/2.0, theView.bounds.size.width, shadowPathWidth);
UIBezierPath *path = [UIBezierPath bezierPathWithRect:shadowRect];
theView.layer.shadowPath = path.CGPath;
}
cell添加阴影
如在cell里面需要定制一个bgVIew
-(UIView *)bgView{
if (!_bgView) {
_bgView = [[UIView alloc] init];
_bgView.layer.cornerRadius = 8.0f;
_bgView.layer.masksToBounds = YES;
}
return _bgView;
}