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];
}
}
网友评论