What is the delegate method called when rightBarButtonItem of UIBarButtonItem is tapped? I want to implement a specific action there.
Delegate method called for rightBarButtonItem of UIBarButtonItem
5.6k Views Asked by Abhinav At
2
There are 2 best solutions below
0
Ashvin
On
You don't need any delegate method. You can simply use the below code. This is code for simply adding a button on the right and adding an action to that button. In my case I called the method named "AddButtonMethod".
UIBarButtonItem *AddButton = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(AddButtonMethod:)];
self.navigationItem.rightBarButtonItem = AddButton;
Related Questions in IPHONE
- UIWebView Screen Fitting Issue
- ios responsive design not working (too wide in portrait orientation)
- Setting View orientation to portrait is ignored
- How do I add custom cells to TableView in Swift?
- UIWebView not loading URL in simulator
- What is the limit for number of subscribers to a stream(publisher's) in opentok/tokbox iOS SDK?
- How to generate request format for WCF web service method for Mac and iPhone
- Difference between gethostname() and [NSProcessInfo hostName]?
- How to force close ipad/iphone keypad when input element is not focused using JS?
- iOS app rejected because of in-app purchase
- iOS coordinates for iPad and iPhone game using spritekit
- What is the best practice when making a storyboard for iPhone and iPad?
- Labels properties changing in Xcode
- Terminating app due to uncaught exception
- Exchange plist data between 2 iPad using iCloud
Related Questions in COCOA-TOUCH
- How to generate request format for WCF web service method for Mac and iPhone
- Application crashes when move from main view controller to another view controller, asks call a stack
- What sort of assets does PHAssetMediaTypeAudio fetch?
- Handoff icon not disappearing from the phone
- How can I use AutoLayout to place view exactly above other?
- How display notification on IOS 8 like in google maps in navigation time
- How can I modally present a UIViewController on another Storyboard that's embedded in a UINavigationController?
- Imports and includes in header files - when is it okay?
- How to listen to changes in Camera authorization status?
- What types/sizes of images do you need when using UIImage full screen?
- Change position of UIImageView when Animating in NSArray
- UITableViewAutomaticDimension + AFNetworking
- Get name of img from for loop
- Multiple CGContextRefs?
- How do i change for background colors or themes for all my screens while clicking one button in setting page for my app in ios, Using objectve c
Related Questions in DELEGATES
- Pass Data between two view controllers using 'Delegation' : Objective-C
- Akka actor invoked with a function delegate - is this bad practice?
- Declare conditional delegate methods in iOS
- JQuery not working after using append()
- Delegates in Navigation Controller
- swift custom UIAlertViewDelegate not work
- IBOutlet nil after closing NSWindow sheet - swift
- Delegate returning nil - Swift
- Implementing delegate methods in separate class
- swift: select dynamic table cell and either push or pop view controller depending on stack
- ios-Facebook login delegate method isn't working
- Xcode, have delegate method auto-include classes
- Subclass as delegate of superclass
- specify type of delegate parameter
- Delegate with generic list signature for passing data to another form
Related Questions in UIBARBUTTONITEM
- ToolBar done button action does not work on UIDatePicker
- How to change the icon of a Bar Button when pressed in Swift?
- Can't add LeftBarButton using storyboard in ios8
- Override navigation controller back button
- UIBarButtonItem bold non-standard font when selected/active
- Can't click custom added UIBarButtonItem
- iOS rightBarButtonItem on UINavigationController in swift
- Add UIToolBar to all keyboards (swift)
- How to add a UIBarButton programmatically AT a particular INDEX
- UIBarButtonItems with background images
- How to have two different colors for two UIBarButtonItem in navigation bar at the same time?
- Showing pop over from Bar Button in Navigation bar in iPhone
- Border Color Issue in UILabel
- How can I change the color of UISearchBar "cancel" button in Swift 3?
- Change the title color of keyboard toolbar objective-C
Related Questions in RIGHTBARBUTTONITEM
- Swift UNavigationItem button display menu labels
- UINavigationController acting funny after pushViewController UPDATE 2
- How to add Navigation Bar "Plus" button, and use it in code
- XLPagerTabStrip: How to add different bar buttons for different tabs using ButtonBarPagerTabStripViewController
- rightBarButtonItem.enabled removes my custom layer from the uinavigationbar
- Delegate method called for rightBarButtonItem of UIBarButtonItem
- Can not show the rightbar button - ios sdk
- navigationItem.rightBarButtonItems is not displayed on the root view controller when popToRootViewController is called
- How do I make the rightBarButtonItem STAY when a view controller is pushed on?
- Bar button not receiving touch
- how do you add left and right bar buttons to UIViewController in swift
- swift how to divide tableview into sections with add to cart working properly?
- Showing dropdown menu (popover) below BarButtonItem on click
- Add rightBarButtonItem on second place Swift
- How can I reset navigation bar items when coming back from popup?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
There is no predefined delegate method. You need to set the delegate/action (similar to a UIControl). For example, create the UIBarButtonItem in viewDidLoad the following way:
and implement actionForTap: in your view controller. If you already have the UIBarButtonItem you can set the target/action to those of your desired delegate method, e.g.:
As a third way, you can configure it in IB (but I'm not going there).