我有这个代码,将图像放在barItem中:
frist.tabBarItem.image = [UIImage imageNamed:@"1.jpg"];
它工作得很好,但图像没有出现,因为图像有256x256像素,我听说图像必须有30x30像素,但我不想手动改变分辨率,我想改变这个每个代码,是否可能?
答案 0 :(得分:1)
尝试这样的事情:
UIImage *image = [UIImage imageNamed:@"1.jpg"];
[image drawInRect:CGRectMake(0, 0, 30, 30)];
frist.tabBarItem.image = image;
答案 1 :(得分:0)
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