How to use default iOS images?

前端 未结 3 794
故里飘歌
故里飘歌 2020-12-24 05:19

I know how to use images in iOS application. But I don\'t know how to use default images like share or bookmark icons which are mention in developer site.

I want to

3条回答
  •  旧巷少年郎
    2020-12-24 06:06

    Swift 5.1, Xcode 11

    Here is one example of SF Symbols..About 1500 system images are provided by apple with different weights and scales.

    let homeSymbolConfiguration = UIImage.SymbolConfiguration(pointSize: 55, weight: .black)
    let homeImage = UIImage(systemName: "house", withConfiguration: homeSymbolConfiguration)
    let width = homeImage?.size.width
    let height = homeImage?.size.height
    let homeButton = UIButton(frame: CGRect(x: 100, y: 100, width: width!, height: height!))
    homeButton.tintColor = UIColor.gray
    homeButton.setImage(homeImage, for: .normal)
    view.addSubview(homeButton)
    

    Apple has provided a Mac app SF Symbols with all the system images. They all are in svg format means they are scalable. You can export and edit them.

    Follow this WWDC 2019 Session 206. https://developer.apple.com/videos/play/wwdc2019/206/

提交回复
热议问题