Tags
ios , swift
Asked 8 years ago
26 Oct 2016
Views 1889
iPhone-coder

iPhone-coder posted

how to change the title of the edit button in swift

Hi

right navigation bar have edit button

i have created edit button using


        let editButton = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Edit, target: self, action: #selector(PViewController.didTapEditButton))
        self.navigationItem.rightBarButtonItem = editButton


i want to know how to change the tile of edit button to \"any text\"
Mitul Dabhi

Mitul Dabhi
answered Nov 30 '-1 00:00

not advisable to change of title of System Item but you can create with out systemItem


      let editButton =  UIBarButtonItem(title: "Any Text", style: UIBarButtonItemStyle.Plain, target: self, action: #selector(PViewController.didTapEditButton))
        self.navigationItem.rightBarButtonItem = editButton


this code will give you right bar in navigation with Any Text button
Post Answer