设置UITabBarController的图片问题

来源:互联网 发布:购买特价机票的软件 编辑:程序博客网 时间:2024/05/17 22:27

在以前开发的项目中,遇到过UITabBarController图片变大的问题

解决办法是把图片名称加后缀@2x。

这样设置以后可能出现图片不居中的问题,可以这样设置

 MainPageViewController *oneVC = [[MainPageViewControlleralloc]init];

    CGFloat offset =5.0;

    oneVC.tabBarItem.image =[UIImageimageNamed:[NSStringstringWithFormat:@"zixun"]];

    oneVC.tabBarItem.imageInsets =UIEdgeInsetsMake(offset, 0, -offset,0);

    oneVC.tabBarItem.selectedImage =[[UIImageimageNamed:[NSStringstringWithFormat:@"zixunPress"]]imageWithRenderingMode:(UIImageRenderingModeAlwaysOriginal)];

    m_firstNavi = [[AGGNavigationControlleralloc]

              initWithRootViewController:oneVC];

通过设置imageInsets来实现
0 0
原创粉丝点击