1

Lately I wanted to include the iOS "star" icon in my NavigationBar. But when I looked at the UIBarButtonItem.SystemItem I noticed that these are limited to 21 icons/images. The "star" and many other icons used in many iOS apps (and even the official Guideline Keynote) are not included.

Is there a way to access them via code?

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
Noodledew
  • 509
  • 4
  • 19
  • You will need to source your own artwork – Paulw11 Oct 10 '18 at 09:23
  • You will need to create you own icon and set it as the `UIBarButton` in navigation bar. There is no way you can access other icons than already provided by Apple. – PGDev Oct 10 '18 at 09:35

1 Answers1

1

if you want to use it as assets, There are many icon websites that provide free and paid assets like icons8.

on another side, if you need those from Xcode there is an only way to make it, use this as UITabBarItem.

Those are the ones coming from the UITabBarItem init with TabBarSystemItem

Simple example

let favoritesItem = UITabBarItem.SystemItem.favorites
let bar = UITabBar(frame: CGRect(x: 20, y: 20, width: 100, height: 60))
let barItem = UITabBarItem(tabBarSystemItem: favoritesItem, tag: 0)
bar.items = [barItem]
view.addSubview(bar)

See more may you need it here

You can also extract iOS SDK icons from SDK from here but I prefer to download it.

Magdy Zamel
  • 470
  • 5
  • 17
  • And how do I use the Tabbar item `let star = UITabBarItem.SystemItem.favorites` as my `rightBarButtonItem` ? – Noodledew Oct 10 '18 at 10:46
  • 1
    I update the answer with a simple example with tab bar you can use it in navigation Bar and Toolbar Icons also – Magdy Zamel Oct 10 '18 at 13:38