百思不得姐-笔记

       // 让按钮内部的所有内容左对齐

        button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;

        

        // 让按钮的内容往左边偏移10

        button.contentEdgeInsets = UIEdgeInsetsMake(0,-10,0,0);

 

UITabBarItem 设置文字的颜色

UINavigationBar 设置nav背景图片

+ (void)initialize{
    
    UINavigationBar *item = [UINavigationBar appearance];
    [item setBackgroundImage:[UIImage imageNamed:@"navigationbarBackgroundWhite"] forBarMetrics:UIBarMetricsDefault];
}

 

 

自定义 UITabBar

自定义类继承 UITabBar 

 

用来修改 UITabBarItem 文字颜色   initialize 在类第一次使用时调用。

 1 + (void)initialize
 2 {
 3    
 4     NSMutableDictionary *dic = [[NSMutableDictionary alloc] init];
 5     dic[NSForegroundColorAttributeName] = [UIColor purpleColor];
 6     
 7     NSMutableDictionary *selectDic = [[NSMutableDictionary alloc] init];
 8     selectDic[NSForegroundColorAttributeName] = [UIColor whiteColor];
 9     
10     UITabBarItem *item = [UITabBarItem appearance];
11     [item setTitleTextAttributes:dic forState:UIControlStateNormal];
12     [item setTitleTextAttributes:selectDic forState:UIControlStateSelected];
13     
14 }

 

用来修改 UITabBarItem 图片的颜色 

1 UIImage *img = [UIImage imageNamed:image];
2 // 修改img的渲染方式,放弃系统自动渲染
3 img = [img imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
4 vc.tabBarItem.image = img;

 

注册cell

[self.userTableView registerNib:[UINib nibWithNibName:NSStringFromClass([KKRecommendUserCell class]) bundle:nil] forCellReuseIdentifier:userCellID];

 

    // 设置 ScrollView 相对于nav的位置,默认64个高度
    self.automaticallyAdjustsScrollViewInsets = NO;
    // 设置边距
    self.userTableView.contentInset = UIEdgeInsetsMake(64, 0, 0, 0);
    self.categorieTavbleView.contentInset = self.userTableView.contentInset;
    

 

 

posted @ 2016-02-21 18:57  人生路1/5  阅读(184)  评论(0编辑  收藏  举报