UITabBarController图像太小

时间:2018-12-04 12:48:12

标签: swift uitabbarcontroller

我有3个版本的图片,分别为75 x 75、50 x 50和25 x 25。

将其设置为标签栏图像时,会产生以下效果:

我期望图像更大,似乎无法对其进行编辑。

我已经以编程方式构建了我的UITabBarController。

SELECT
  s.studentid,
  s.woonplaats,
  s.Lesid,
  f.SoortOV,
  f.Date,
  f.Comment 
 FROM
  filteredtweets f 
  INNER JOIN
      rooster r 
       ON f.Time >= r.Timestart::TIMESTAMP + (30 || ' minutes')::interval 
       OR f.Time <= r.Timestart::TIMESTAMP + (30 || ' minutes')::interval 
 INNER JOIN
     student s 
       ON f.Place = s.woonplaats

1 个答案:

答案 0 :(得分:0)

尝试在UIImage扩展名中添加此功能

extension UIImage {

    func resize(targetSize: CGSize) -> UIImage {
        return UIGraphicsImageRenderer(size:targetSize).image { _ in
            self.draw(in: CGRect(origin: .zero, size: targetSize))
        }
    }

}

然后在viewDidLoad中更改代码行

viewControllers = [
        generateNavigationController(with: ChatBotController(), image: #imageLiteral(resourceName: "tabBar_bot_head").withRenderingMode(.alwaysOriginal)),
    ]

与此

viewControllers = [
        generateNavigationController(with: ChatBotController(), image: #imageLiteral(resourceName: "tabBar_bot_head").withRenderingMode(.alwaysOriginal)).resize(targetSize: CGSize(width: 50, height: 50)),
    ]