ios中常用小技巧注意点
来源:互联网 发布:图像融合算法 编辑:程序博客网 时间:2024/05/29 02:33
1.设置图片原图显示
UIImage*image=[UIImage imageNamed:@"place_map.png"];UIImage*original=[image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; self.navigationItem.rightBarButtonItem=[[UIBarButtonItem alloc]initWithImage:original style:UIBarButtonItemStylePlain target:self action:@selector(locationPress)];
2.修改全局barButton渲染颜色 和字体样式
UINavigationBar *navgationBar = [UINavigationBar appearance]; navgationBar.tintColor = [UIColor colorWithRed:0.61f green:0.61f blue:0.61f alpha:1.00f]; [[UINavigationBar appearance] setTitleTextAttributes:@{NSFontAttributeName:[UIFont boldSystemFontOfSize:15],NSForegroundColorAttributeName:UIColorWithHexRGB(0xfe6d27)}]; [[UITabBarItem appearance] setTitleTextAttributes:@{NSFontAttributeName : [UIFont boldSystemFontOfSize:10],NSForegroundColorAttributeName : kRGBCOLOR(170,170,170)} forState:UIControlStateNormal]
3、隐藏tabbar
-(void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated { viewController.hidesBottomBarWhenPushed = YES; [super pushViewController:viewController animated:animated]; if (self.childViewControllers.count==1) { viewController.hidesBottomBarWhenPushed = NO; }}
4、TableView的Group样式中,默认的每个section都有sectionHeader和sectionFooter,只要调整这两个的大小就可以实现section之前的间距扩大或缩小
//tableview自带35距离self.tableView.contentInset = UIEdgeInsetsMake(-35,0,0,0);
5、获取label大小
textLabel.size = [textLabel.text boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, textLabel.font.lineHeight) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName : textLabel.font} context:nil].size;
6、tableviewcell让分割线从头开始
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { if ([cell respondsToSelector:@selector(setSeparatorInset:)]) { [cell setSeparatorInset:UIEdgeInsetsZero]; } if ([cell respondsToSelector:@selector(setLayoutMargins:)]) { [cell setLayoutMargins:UIEdgeInsetsZero]; } }
7、设置导航栏是否显示及改变状态栏文字颜色
- (void)viewWillAppear:(BOOL)animated{ [super viewWillAppear:animated]; //设置状态栏字体为白色 [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent; self.navigationController.navigationBar.hidden = YES;}- (void)viewWillDisappear:(BOOL)animated{ [super viewWillDisappear:animated]; //设置状态栏字体为黑色 [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault; self.navigationController.navigationBar.hidden = NO;}
0 0
- ios中常用小技巧注意点
- iOS 小技巧及注意点(OC)
- ios开发中常用小技巧
- iOS 常用小技巧
- MySQL数据库小技巧(注意点)
- IOS开发中注意点
- iOS编程中注意点
- iOS -常用小技巧大杂烩
- iOS - UIScrollView控件 常用属性、注意点
- 在ios中开发使用自动布局约束小注意点。
- shell中常用小技巧
- JavaScript中的小技巧和注意点(一)
- JavaScript中的小技巧和注意点(二)
- IOS中UITableViewController使用注意点
- iOS中TableView小技巧
- iOS中TableView小技巧
- iOS开发技巧--点属性的小隐晦技巧
- 【IOS基础知识】之常用小技巧
- handler.postDelayed()方法
- MySQL Utilities工具包概述及安装
- Android中资源各种引用方式?,@,@*等等
- GF(2^8)运算一一(二)
- SpringMVC与RESTful
- ios中常用小技巧注意点
- 关于微信表情及输入法emoji显示问题解决方案
- LeetCode系列Easy【1】 Algorithms - Bit manipulation
- 记录一下
- 解密Log4j、SLF4J、Common-logging的区别
- 获取Android设备上的所有存储设备
- Parallax occlusion Mapping 视差贴图 (基于法线贴图)
- log4j日志级别以及配置
- spring+mybatis 多数据源整合