1. 设置TabBarItem图片的大小

 1 - (void)configurationAppTabBarAndNavigationBar
 {
     // 选中的item普通状态图片的大小
     UIImage *normalImage = self.navigationController.tabBarController.tabBar.selectedItem.image;
     UIImage *tabNormalImage = [ToolObject createNewImageWithColor:normalImage multiple:1.1];
     tabNormalImage = [tabNormalImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
     [self.navigationController.tabBarController.tabBar.selectedItem setImage:tabNormalImage];
     // 选中的item选中撞他图片的大小
     UIImage *selectImage = self.navigationController.tabBarController.tabBar.selectedItem.selectedImage;
     UIImage *tabSelectImage = [self createNewImageWithColor:selectImage multiple:1.1];
     tabSelectImage = [tabSelectImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];12   // 设置点击图片放大缩小的动画
     [self.navigationController.tabBarController.tabBar.selectedItem setSelectedImage:tabSelectImage];
     self.navigationController.tabBarController.tabBar.tintColor = [UIColor colorWithRed:0.11f green:0.61f blue:0.97f alpha:1.00f];
     self.navigationController.tabBarController.tabBar.barTintColor = [UIColor colorWithRed:0.85f green:0.85f blue:0.85f alpha:1.00f];
 }
2.图片放大或压缩处理 ,图片放大倍数 0 ~ 2 之间 ,0~1 缩小图片,1~2 放大图片 

 1 /**
  *  根据image 返回放大或缩小之后的图片
  *
  *  @param image    原始图片
  *  @param multiple 放大倍数 0 ~ 2 之间
  *
  *  @return 新的image
  */
 + (UIImage *) createNewImageWithColor:(UIImage *)image multiple:(CGFloat)multiple
 {
     CGFloat newMultiple = multiple;
     ) {
         newMultiple = ;
     }
      && fabs(multiple) < ) || (fabs(multiple)> && fabs(multiple)<))
     {
         newMultiple = multiple;
     }
     else
     {
         newMultiple = ;
     }
     CGFloat w = image.size.width*newMultiple;
     CGFloat h = image.size.height*newMultiple;
     CGFloat scale = [UIScreen mainScreen].scale;
     UIImage *tempImage = nil;
     CGRect imageFrame = CGRectMake(, , w, h);
     UIGraphicsBeginImageContextWithOptions(image.size, NO, scale);
     [[UIBezierPath bezierPathWithRoundedRect:imageFrame cornerRadius:] addClip];
     [image drawInRect:imageFrame];
     tempImage = UIGraphicsGetImageFromCurrentImageContext();
     UIGraphicsEndImageContext();
     return tempImage;
 }

这样就可以修改选中状态和普通状态下的TabBarItem 图片的大小 ,是不是很简单呢,不足之处,还请大家多多指教

iOS 使用系统的UITabBarController 修改展示的图片大小的更多相关文章

  1. 修改jpg的图片大小

    using System.Drawing.Imaging; public void ResizePic(string oldFilePath, int thumbnailImageWidth, int ...

  2. iOS开发UI篇—UITabBarController简单介绍

    iOS开发UI篇—UITabBarController简单介绍 一.简单介绍 UITabBarController和UINavigationController类似,UITabBarControlle ...

  3. [转帖]迅为4412开发板最小linux系统的存储空间修改

    本文转自迅为论坛:http://www.topeetboard.com 最小linux系统的存储空间修改以修改成 1G 存储空间为例来修改,如果需要改成其他大小的存储空间,参照此方法修改即可. 首先连 ...

  4. [分享]运维分享一一阿里云linux系统mysql密码修改脚本

    [分享]运维分享一一阿里云linux系统mysql密码修改脚本       大象吃豆子 级别: 小白 发帖 12 云币 27 加关注 写私信   只看楼主 更多操作楼主  发表于: 2014-09-3 ...

  5. ios UIWebView截获html并修改便签内容(转载)

    ios UIWebView截获html并修改便签内容 博客分类: iphone开发iphone开发phoneGap uiwebviewstringByEvaluatingJavaScriptFromS ...

  6. IOS UIWebView截获html并修改便签内容,宽度自适应

    需求:混合应用UIWebView打开html后,UIWebView有左右滚动条,要去掉左右滚动效果:  方法:通过js截获UIWebView中的html,然后修改html标签内容:  实例代码:  服 ...

  7. iOS开发UI篇—UITabBarController生命周期(使用storyoard搭建)

    iOS开发UI篇—UITabBarController生命周期(使用storyoard搭建)   一.UITabBarController在storyoard中得搭建 1.新建一个项目,把storyb ...

  8. ios UIWebView截获html并修改便签内容

    需求:混合应用UIWebView打开html后,UIWebView有左右滚动条,要去掉左右滚动效果: 方法:通过js截获UIWebView中的html,然后修改html标签内容: 实例代码: 服务器端 ...

  9. iOS 捕获系统外异常

    iOS 捕获系统外异常 太阳火神的漂亮人生 (http://blog.csdn.net/opengl_es) 本文遵循"署名-非商业用途-保持一致"创作公用协议 转载请保留此句:太 ...

随机推荐

  1. 【shell】概述

    功能简介 批量自动初始化系统(update,软件安装,时区设置,安全策略...) 批量自动部署软件(LAMP,LNMP,Nginx,LVS,Tomcat) 管理应用程序(KVM,集群管理扩容,MySQ ...

  2. day47-线程-锁和死锁

    #1.锁:防止多个线程同时读写某一块内存区域. from threading import Thread from threading import Lock def func(): global n ...

  3. ORs-4-Enhanced Role of OR Gene Loss (Pseudogenization) in Birds

    Enhanced Role of OR Gene Loss (Pseudogenization) in Birds 1.因为文献已经证明(a)基因缺失和得到对于进化有影响,(b)大的基因家族对进化影响 ...

  4. Java基础语法要点

    1.Java中byte.short.int.long的取值范围 byte:[-128,127] short:[-32768,32767] int:[-2147483648,2147483647] lo ...

  5. Java面试题4-附答案

    BIO.NIO和AIO的区别   Java BIO : 同步并阻塞,服务器实现模式为一个连接一个线程,即客户端有连接请求时服务器端就需要启动一个线程进行处理,如果这个连接不做任何事情会造成不必要的线程 ...

  6. python爬虫和数据分析、数据挖掘

    一.python爬虫脑图: 二.python爬虫流程: 三.python数据分析简介 四.python数据预处理方法 五.python数据挖掘 六.数据探索基础

  7. 基础_1:RCP基本框架

    Display: Display是一个SWT对象,代表底层图形系统的实现.一个RCP应用程序只需要一个Display对象. Display的主要任务是从操作系统队列中读取事件,传递给RCP的事件监听器 ...

  8. QTP基本循环异常遍历(代码方式实现)

    0 环境 系统环境:win7 1 前言 在正常循环的基础下 添加异常处理遍历 一些基本操作 请看正常循环 https://www.cnblogs.com/my-ordinary/p/11739180. ...

  9. Qt platform plugin 'windows' 问题的解决方法

    关于Qt 发布程序时遇到qt platform plugin ‘windows’问题的解决方法如下  遇到这个问题,一般应该已经把一部分dll拷贝到了发布的可执行文件同级目录, 我是直接添加C:\Qt ...

  10. OpenCV 使用二维特征点(Features2D)和单映射(Homography)寻找已知物体

    #include <stdio.h> #include <iostream> #include "opencv2/core/core.hpp" #inclu ...