1.設(shè)置圖片原圖顯示
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,只要調(diào)整這兩個的大小就可以實現(xiàn)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];
}
}