Question

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 use them. Do I need to download those set of images or those are available in Xcode?

If we have to download them, where I can get those icons?

Was it helpful?

Solution 3

Developers haven't direct access to these images. I mean that you can't initialise image object like this:

UIImage *image = [UIImage imageNamed:@"name_of_system_image"];

But you can display some of images by using system types. For example you could init UIBarButtonItem with system types that provides standard icons:
- (id)initWithBarButtonSystemItem:(UIBarButtonSystemItem)systemItem target:(id)target action:(SEL)action

Where UIBarButtonSystemItem provides such types:

UIBarButtonSystemItemDone, UIBarButtonSystemItemCancel,
UIBarButtonSystemItemEdit,
UIBarButtonSystemItemSave,
UIBarButtonSystemItemAdd,
UIBarButtonSystemItemFlexibleSpace,
UIBarButtonSystemItemFixedSpace,
UIBarButtonSystemItemCompose,
UIBarButtonSystemItemReply,
UIBarButtonSystemItemAction,
UIBarButtonSystemItemOrganize,
UIBarButtonSystemItemBookmarks,
UIBarButtonSystemItemSearch,
UIBarButtonSystemItemRefresh,
UIBarButtonSystemItemStop,
UIBarButtonSystemItemCamera,
UIBarButtonSystemItemTrash,
UIBarButtonSystemItemPlay,
UIBarButtonSystemItemPause,
UIBarButtonSystemItemRewind,
UIBarButtonSystemItemFastForward,
UIBarButtonSystemItemUndo,
UIBarButtonSystemItemRedo,
UIBarButtonSystemItemPageCurl

OTHER TIPS

Now starting from Swift 5.1 and Xcode 11 you can load 1 from over 1500 system images with the new UIImage Api UIImage(systemName: "imageName") which are vector based so no worries about qualities for different sizes

https://developer.apple.com/design/resources/

enter image description here

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/

In swift : For System images , Simply do it

imageView?.image = UIImage(systemName: "face.smiling")

happy coding :) Hit Upvote

System Resources are here: https://developer.apple.com/design/resources/

For older iOS versions:

 if #available(iOS 13.0, *) {
            cell.buttonImageIcon.image = UIImage(systemName: "info.circle.fill")
            cell.profileButton.tintColor = UIColor.white
            cell.profileButton.setTitle("PERSONAL INFORMATION", for: .normal)
        } else {
            // Fallback on earlier versions
        }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top