zoukankan      html  css  js  c++  java
  • UITabbar item 设置笔记

      很长一段时间都是用代码来写UITabbarController,试着用xib来写一次,但是遇到tabbar item的图标自定义的时候不知道从何入手,比如定义选定前和选定后的icon图片,这地方还是不太明显。现在用代码记录一下

    [[UITabBar appearance] setBackgroundImage:[UIImage imageNamed:@"tabBar.png"]];
    或
     [[self.RootTabbarController tabBar] setBackgroundImage:[UIImageimageNamed:@"tabbar.png"]];
     
    
    ITabBarController *tabController = (UITabBarController *)self.window.rootViewController;
        
        selectedImage = [UIImage imageNamed:@"contact"];
        unselectedImage = [UIImage imageNamed:@"contact"];
        UITabBarItem *item3 = [tabBar.items objectAtIndex:2];
        [item3 setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
                                       COLOR_APP,UITextAttributeTextColor, nil]
                             forState:UIControlStateNormal];
    
    //    [item3 setFinishedSelectedImage:selectedImage
    //        withFinishedUnselectedImage:unselectedImage];
        [item3 setImage:selectedImage];
        [item3 setSelectedImage:selectedImage];
    

      

    这个图片上标记了tabbar item的各种属性

      

    UIimageWithRenderingMode:UIImageRenderingModeAlwaysTemplate这个作为ios7里面的新属性,应该注意
    很多时候在ios7上使用自定义的tabbar,tabbar顶部会出现一个线,此时解决方案

        [[UITabBarappearance] setShadowImage:[[UIImagealloc] init]];
    原理是用一个一像素的线图覆盖。

     

  • 相关阅读:
    Python中的单例模式
    硬件资产管理系统总结
    浏览器同源策略之JSONP、CORS
    设置全局的csrf跨站请求伪造
    keystone命令与client接口学习
    实验室双显示屏安装使用记录
    redhat 5.4 下rabbitMQ单机安装.md
    Android Studio Connection refused: connect 错误解决
    Add Google Maven repository and sync project
    Java向上转型和向下转型
  • 原文地址:https://www.cnblogs.com/sanjianghuiliu/p/3669793.html
Copyright © 2011-2022 走看看