【发布时间】:2014-03-03 22:22:06
【问题描述】:
我有这个代码,将图像放在 barItem 中:
frist.tabBarItem.image = [UIImage imageNamed:@"1.jpg"];
效果很好,但是图像没有出现,因为图像有 256x256 像素,我听说图像必须有 30x30 像素,但我不想手动更改分辨率,我想更改这个每个代码,可能吗?
【问题讨论】:
标签: ios objective-c uitabbaritem
我有这个代码,将图像放在 barItem 中:
frist.tabBarItem.image = [UIImage imageNamed:@"1.jpg"];
效果很好,但是图像没有出现,因为图像有 256x256 像素,我听说图像必须有 30x30 像素,但我不想手动更改分辨率,我想更改这个每个代码,可能吗?
【问题讨论】:
标签: ios objective-c uitabbaritem
试试这样的:
UIImage *image = [UIImage imageNamed:@"1.jpg"];
[image drawInRect:CGRectMake(0, 0, 30, 30)];
frist.tabBarItem.image = image;
【讨论】:
let moreVC = storyboard.instantiateViewController(withIdentifier: "MoreVC")
moreVC.tabBarItem = UITabBarItem(title: "More", image: UIImage(named: "fifth"), tag: 5)
moreVC.tabBarItem.imageInsets.top = 7
moreVC.tabBarItem.imageInsets.bottom = 7
【讨论】: