Search code examples
iosxcode5uibarbuttonitemuinavigationitem

Bar Button Item Issue


I have a Bar Button called SAVE when the program running its automatically displays the title of SAVE but while i edit the contents in that particular view, the title should be changed as EDIT is there any codings are available for it?


Solution

  • Set the tag in your button.

    -(IBAction) add:(id)sender
    {
        if([sender tag] == 0){
    
    // set the button title as "Save"      
    
        }
        else{
    // set the button title as "Edit"  
            Button1.tag=0;
        }
    }
    

    Hope this will help you.