简体   繁体   中英

I have Icon with 1x,2x,3x image with navigation

I have multi-image I add to bar item image but when I add it shows very big and I can't shrink them I don't know and I have costume back button but when I add it it shows far from the top left I use this code to add custom back but I add the bar item from storyboard if anyone can help.

这个图标的图像

let backImg: UIImage = UIImage(named: "back-btn")!
    let newBackButton = UIBarButtonItem(image: backImg, style: .plain, target: self, action: #selector(QuestionViewController.back(sender:)))
    self.navigationItem.leftBarButtonItem = newBackButton

Navigation Bar and Toolbar Icon Size

Use the following sizes for guidance when preparing custom navigation bar and toolbar icons, but adjust as needed to create balance.

在此处输入图片说明

For navigation set icons in image assets (Assets.xcassets) 1X = 28x28 pixel, 2X = 56x56 pixel and 3X = 84x84 pixel icon size.

https://developer.apple.com/design/human-interface-guidelines/ios/icons-and-images/custom-icons/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM