Small and iOS knowledge points in iOS
1. Hide the scroll bar in tableView
self.tableView.showsVerticalScrollIndicator = NO;
2. About attributes
Use assign: Use copy for basic data types (NSInteger, CGFloat) and C data types (int, float, double, char, etc.): Use retain (strong) for NSString ): for other NSObject and its subclass 3. register cell
// Register cell [self. tableView registerNib: [UINib nibWithNibName: NSStringFromClass ([DDZRecommendCategoryCell class]) bundle: nil] forCellReuseIdentifier: @ "category"];
4. Reuse cell
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"category"];
5. Refresh the page
[self.tableView reloadData];
Generally, the update display function is used after the server data is requested.
6. appearance uniformly sets the appearance
// Set NSMutableDictionary * attrs = [NSMutableDictionary dictionary] In appearance; attrs [dictionary] = [UIFont systemFontOfSize: 13]; attrs [interval] = [UIColor grayColor]; // set the appearance of item (condition: UI_APPEARANCE_SELECTOR is followed by the method) UITabBarItem * item = [UITabBarItem appearance]; [item setTitleTextAttributes: attrs forState: UIControlStateNormal]
7. Use your custom tabbar
// Change the tabBar (use KVC to directly change the member variable) [self setValue: [[DDZTabBar alloc] init] forKey: @ "tabBar"];
In your tabber class
Use-(void) layoutSubviews to adjust the position of the internal subview
8. Make your code called only once
For example, appearance can be set once.
+ (void)initialize
9. The first line is selected by default in tableView.
// By default, the first line [self. tableView selectRowAtIndexPath: [NSIndexPath indexPathForRow: 0 inSection: 0] animated: NO scrollPosition: UITableViewScrollPositionTop] is selected.
10. Set insert (the displayed content is blocked in the navigation bar of UITbaleView)
// Set insert self. automaticallyAdjustsScrollViewInsets = NO; self. tableView. contentInset = UIEdgeInsetsMake (64, 0, 0, 0 );
11. Set the cell height (the default cell height is 44)
self.tableView.rowHeight = 70;