1.tableView隐藏滚动条
self.tableView.showsVerticalScrollIndicator = NO;
2.关于属性
使用assign: 对基础
数据类型 (NSInteger,CGFloat)和C数据类型(int, float, double, char, 等等) 使用copy: 对NSString
使用retain(strong): 对其他NSObject和其子类
3.注册cell
//注册cell [self.tableView registerNib:[UINib nibWithNibName:NSStringFromClass([DDZRecommendCategoryCell class]) bundle:nil] forCellReuseIdentifier:@"category"];
4.复用cell
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"category"];
5.刷新页面
[self.tableView reloadData];
一般在请求服务器数据后,更新显示使用
6.appearance统一设置外观
//在appearance统一设置 NSMutableDictionary *attrs = [NSMutableDictionary dictionary]; attrs[NSFontAttributeName] = [UIFont systemFontOfSize:13]; attrs[NSForegroundColorAttributeName] = [UIColor grayColor]; //item的appearance外观设置(条件限制:方法后面有UI_APPEARANCE_SELECTOR) UITabBarItem *item = [UITabBarItem appearance]; [item setTitleTextAttributes:attrs forState:UIControlStateNormal];
7.使用自己自定义的tabbar
//更换tabBar(利用KVC直接更改成员变量) [self setValue:[[DDZTabBar alloc] init] forKey:@"tabBar"];
在自己的tabber类中
利用- (void)layoutSubviews,调整内部子视图的位置
8.使自己的代码只被调用一次
例如appearance统一设置一次就够了
+ (void)initialize
原标题:iOS中的小知识点
关键词:IOS