在开发过程中总是遇到一些小的知识点,太散不容易记住,每次还需要各种找,今天想把遇到的知识点总结起来,以备日后查看
1. 对NavigationController 中的navigationBar 进行隐藏以及显示会影响到其他的页面,因为 NavigationController 是全局共用一个的,所以我们在当前页面需要隐藏或者显示的时候不要忘了要在离开该页面时候恢复NavigationController 的状态
-(void)viewWillAppear:(BOOL)animated{
self.navigationController.navigationBar.hidden = YES;
}
-(void)viewWillDisappear:(BOOL)animated{
self.navigationController.navigationBar.hidden = NO;
}
2.我们在进行页面跳转之后还想回到原来的页面不要使用跳转到该页面时候使用的 Push 或者 Present 方法,要使用下面的“返回”方法
[[self navigationController] popViewControllerAnimated:YES];
3.设置按钮的边框以及圆角
[doneBtn.layer setMasksToBounds:YES];
// [doneBtn.layer setCornerRadius:8.0]; //设置矩圆角半径
[doneBtn.layer setBorderWidth:1.0]; //边框宽度
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGColorRef colorref = CGColorCreate(colorSpace,(CGFloat[]){ 1, 0, 0, 1 });
[doneBtn.layer setBorderColor:colorref];//边框颜色
4.UITableViewCell 选中不变色
cell.selectionStyle = UITableViewCellSelectionStyleNone;
5.UITableViewStyleplain 类型无线
myTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
6.在本页面控制下一个页面的back状态以及事件
self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:self action:@selector(click_backBarButtonItem:)];
- (void)click_backBarButtonItem:(UIBarButtonItem *)sender {
[self.navigationController popViewControllerAnimated:YES];
}
7.在使用UITableView 的HeaderView 或者FooterVIew 的时候必须设定 View 的高度
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
return 44.f;
}
- (UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
SearchTableView *headerView = [[SearchTableView alloc]init];
return headerView;
}
8.清除Xcode 的缓存文件
前往->文件夹->~/Library/Developer/Xcode/DerivedData 回车 删除即可
9.iOS语言是不支持多继承的,切记切记
未完待续。。。}