How to add / use default icons to navigation bar

后端 未结 3 656
迷失自我
迷失自我 2020-12-31 07:42

I want to use some of default iOS icons i.e.

in navigation bar.
Basically I don\'t know how to call image of that item (directly from native library - I kno

3条回答
  •  盖世英雄少女心
    2020-12-31 08:02

    You can use UIBarButtonSystemItem this way:

    let button = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Refresh, target: self, action: "someAction")
    navigationItem.leftBarButtonItem = button
    

    Result for leftBarButtonItem:

    If you want to set it at right side you can use this code:

    navigationItem.rightBarButtonItem = button
    

    Result for rightBarButtonItem:

提交回复
热议问题