//状态栏高度
CGFloat statusBarH = [[UIApplication sharedApplication] statusBarFrame].size.height;
//导航栏高度
CGFloat navigationBarH = self.navigationController.navigationBar.frame.size.height;
-------------------------------------------------------------------------------------------------------------------------------------------------------------
//设置导航栏背景颜色
self.navigationController.navigationBar.barTintColor = RGBA(46, 148, 255, 1);
//设置导航栏标题字体大小、颜色
[[self.navigationController navigationBar] setTitleTextAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:17], NSForegroundColorAttributeName:[UIColor whiteColor]}];
-------------------------------------------------------------------------------------------------------------------------------------------------------------
//键盘回收
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
UITouch *touch = [touches anyObject];
if (![touch.view isKindOfClass: [UITextField class]] || ![touch.view isKindOfClass: [UITextView class]]) {
[self.view endEditing:YES];
}
}
-------------------------------------------------------------------------------------------------------------------------------------------------------------
//动画退出
- (void)exitApplication {
AppDelegate *app = [UIApplication sharedApplication].delegate;
UIWindow *window = app.window;
[UIView animateWithDuration:0.5f animations:^{
window.alpha = 0;
window.frame = CGRectMake(0, window.bounds.size.width, 0, 0);
} completion:^(BOOL finished) {
exit(0);
}];
}
-------------------------------------------------------------------------------------------------------------------------------------------------------------
//UILabel 字体居中设置
label.textAlignment = NSTextAlignmentCenter;