0%

iOS开发Tips

iOS开发Tips

TableView Cell留白问题

TableView的在iPad下横屏显示的时候右侧会有很多留白。

解决办法:

1
tableview.cellLayoutMarginsFollowReadableWidth = NO;

TableView多余的分割线

1
tableView.tableFooterView = [UIView new];

TableViewCell右侧箭头

1
cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;

判断App是不是第一次启动

1
2
3
4
5
6
7
8
//   使用NSUserDefaults来判断程序是否第一次启动
NSUserDefaults *TimeOfBootCount = [NSUserDefaults standardUserDefaults];
if (![TimeOfBootCount valueForKey:@"time"]) {
[TimeOfBootCount setValue:@"sd" forKey:@"time"];
NSLog(@"第一次启动");
}else{
NSLog(@"不是第一次启动");
}

push隐藏tabbar

1
2
3
CYTeacherViewController *vc = [[CYTeacherViewController alloc]init];
[vc setHidesBottomBarWhenPushed:YES];
[self.navigationController pushViewController:vc animated:YES];

设置导航栏的返回按钮颜色

1
self.navigationController.navigationBar.tintColor = [UIColor whiteColor];