Add Button items to the Navigation Bar iOS swift. || Bar button item iOS swift

Solution:

In navigationBar you can add buttons at right side and also in left side.

The below are the code for adding the bar button items.


    var addBtn:UIBarButtonItem!

In didload add the below code

        addBtn = UIBarButtonItem(image:ic_mode_edit_white, style: .plain, target: self, action: #selector(ViewController.didTapOnSave(_:)))
        self.navigationItem.rightBarButtonItems = [addBtn]


Run the app and enjoy with cheers...

Comments

Popular posts from this blog

Invalid bundle error while upload the app to the app Store

Convert NsNumber, NSDate to String in iOS Swift

Global LocationManager Singleton class iOS Swift