Class: UIBarButtonItem
Overview
A bar button item is a button specialized for placement on a UIToolbar or UINavigationBar object. It inherits basic button behavior from its abstract superclass, UIBarItem. The UIBarButtonItem defines additional initialization methods and properties for use on toolbars and navigation bars.
Direct Known Subclasses
Instance Attribute Summary (collapse)
-
- action
The selector defining the action message to send to the target object when the user taps this bar button item.
-
- customView
A custom view representing the item.
-
- possibleTitles
The set of possible titles to display on the bar button.
-
- style
The style of the item.
-
- target
The object that receives an action when the item is selected.
-
- tintColor
The tint color for the button item.
-
- width
The width of the item.
Attributes inherited from UIBarItem
#enabled, #image, #imageInsets, #landscapeImagePhone, #landscapeImagePhoneInsets, #tag, #title
Instance Method Summary (collapse)
-
- backButtonBackgroundImageForState:barMetrics:
Returns the back button background image for a given control state and bar metrics.
-
- backButtonBackgroundVerticalPositionAdjustmentForBarMetrics:
Returns the back button vertical position offset for given bar metrics.
-
- backButtonTitlePositionAdjustmentForBarMetrics:
Returns the back button title offset for given bar metrics.
-
- backgroundImageForState:barMetrics:
Returns the background image for a given state and bar metrics.
-
- backgroundImageForState:style:barMetrics:
Returns the background image for the specified state, style, and metrics.
-
- backgroundVerticalPositionAdjustmentForBarMetrics:
Returns the background vertical position offset for given bar metrics.
-
- initWithBarButtonSystemItem:target:action:
Initializes a new item containing the specified system item.
-
- initWithCustomView:
Initializes a new item using the specified custom view.
-
- initWithImage:landscapeImagePhone:style:target:action:
Initializes a new item using the specified images and other properties.
-
- initWithImage:style:target:action:
Initializes a new item using the specified image and other properties.
-
- initWithTitle:style:target:action:
Initializes a new item using the specified title and other properties.
-
- setBackButtonBackgroundImage:forState:barMetrics:
Sets the back button background image for a given control state and bar metrics This modifier applies only to navigation bar back buttons and is ignored by other buttons.For good results, backgroundImage must be a stretchable image.
-
- setBackButtonBackgroundVerticalPositionAdjustment:forBarMetrics:
Sets the back button vertical position offset for given bar metrics.
-
- setBackButtonTitlePositionAdjustment:forBarMetrics:
Sets the back button title offset for given bar metrics This modifier applies only to navigation bar back buttons and is ignored by other buttons.
-
- setBackgroundImage:forState:barMetrics:
Sets the background image for a given state and bar metrics.
-
- setBackgroundImage:forState:style:barMetrics:
Sets the background image for the specified state, style, and metrics.
-
- setBackgroundVerticalPositionAdjustment:forBarMetrics:
Sets the background vertical position offset for given bar metrics.
-
- setTitlePositionAdjustment:forBarMetrics:
Sets the title offset for given bar metrics.
-
- titlePositionAdjustmentForBarMetrics:
Returns the title offset for given bar metrics.
Methods inherited from UIBarItem
#setTitleTextAttributes:forState:, #titleTextAttributesForState:
Methods inherited from NSObject
#!, #!=, #!~, #, #==, #===, #=~, #Rational, #__callee__, #__method__, #__send__, #__type__, `, alloc, allocWithZone:, #autoContentAccessingProxy, autoload, autoload?, autorelease_pool, #awakeAfterUsingCoder:, binding, block_given?, caller, cancelPreviousPerformRequestsWithTarget:, cancelPreviousPerformRequestsWithTarget:selector:object:, catch, class, classFallbacksForKeyedArchiver, #classForCoder, #classForKeyedArchiver, classForKeyedUnarchiver, #clone, conformsToProtocol:, #copy, copyWithZone:, #dealloc, #define_singleton_method, description, display, #doesNotRecognizeSelector:, #dup, #enum_for, #eql?, #equal?, #extend, fail, #finalize, format, #forwardInvocation:, #forwardingTargetForSelector:, framework, #freeze, #frozen?, getpass, gets, global_variables, #init, initialize, #initialize_clone, #initialize_copy, #initialize_dup, #inspect, instanceMethodForSelector:, instanceMethodSignatureForSelector:, #instance_eval, #instance_exec, #instance_of?, #instance_variable_defined?, #instance_variable_get, #instance_variable_set, #instance_variables, instancesRespondToSelector:, isSubclassOfClass:, #is_a?, iterator?, #kind_of?, lambda, load, load_bridge_support_file, load_plist, local_variables, loop, #method, #methodForSelector:, #methodSignatureForSelector:, #methods, #mutableCopy, mutableCopyWithZone:, new, #nil?, open, p, #performSelector:onThread:withObject:waitUntilDone:, #performSelector:onThread:withObject:waitUntilDone:modes:, #performSelector:withObject:afterDelay:, #performSelector:withObject:afterDelay:inModes:, #performSelectorInBackground:withObject:, #performSelectorOnMainThread:withObject:waitUntilDone:, #performSelectorOnMainThread:withObject:waitUntilDone:modes:, print, printf, #private_methods, proc, #protected_methods, #public_method, #public_methods, #public_send, putc, puts, raise, rand, readline, readlines, #replacementObjectForCoder:, #replacementObjectForKeyedArchiver:, require, resolveClassMethod:, resolveInstanceMethod:, #respond_to?, #respond_to_missing?, select, #send, setVersion:, #singleton_methods, sprintf, srand, superclass, #taint, #tainted?, #tap, test, throw, #to_plist, #to_s, trace_var, trap, #trust, #untaint, untrace_var, #untrust, #untrusted?, version
Constructor Details
This class inherits a constructor from NSObject
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class NSObject
Instance Attribute Details
- (Symbol) action
The selector defining the action message to send to the target object when the user taps this bar button item. If the value of this property is NULL, no action message is sent. The default value is NULL.
- (UIView) customView
A custom view representing the item.
- (NSSet) possibleTitles
The set of possible titles to display on the bar button. Use this property to provide a hint to the system on how to correctly size the bar button item to be wide enough to accommodate your widest title. Set the value of this property to an NSSet object containing all the titles you intend as possible titles for the bar button item. Use the actual text strings you intend to display.This property applies to bar button items placed on navigation bars or toolbars.
- (UIBarButtonItemStyle) style
The style of the item. One of the constants defined in UIBarButtonItemStyle. The default value is UIBarButtonItemStylePlain.
- (Object) target
The object that receives an action when the item is selected. If nil, the action message is passed up the responder chain where it may be handled by any object implementing a method corresponding to the selector held by the action property. The default value is nil.
- (UIColor) tintColor
The tint color for the button item.
- (Float) width
The width of the item. If this property value is positive, the width of the combined image and title are fixed. If the value is 0.0 or negative, the item sets the width of the combined image and title to fit. This property is ignored if the style uses radio mode. The default value is 0.0.
Instance Method Details
- (UIImage) backButtonBackgroundImageForState(state, barMetrics:barMetrics)
Returns the back button background image for a given control state and bar metrics. This modifier applies only to navigation bar back buttons and is ignored by other buttons.
- (Float) backButtonBackgroundVerticalPositionAdjustmentForBarMetrics(barMetrics)
Returns the back button vertical position offset for given bar metrics. This modifier applies only to navigation bar back buttons and is ignored by other buttons.This offset is used to adjust the vertical centering of bordered bar buttons within the bar.
- (UIOffset) backButtonTitlePositionAdjustmentForBarMetrics(barMetrics)
Returns the back button title offset for given bar metrics. This modifier applies only to navigation bar back buttons and is ignored by other buttons.
- (UIImage) backgroundImageForState(state, barMetrics:barMetrics)
Returns the background image for a given state and bar metrics.
- (UIImage) backgroundImageForState(state, style:style, barMetrics:barMetrics)
Returns the background image for the specified state, style, and metrics.
- (Float) backgroundVerticalPositionAdjustmentForBarMetrics(barMetrics)
Returns the background vertical position offset for given bar metrics. This offset is used to adjust the vertical centering of bordered bar buttons within the bar.
- (Object) initWithBarButtonSystemItem(systemItem, target:target, action:action)
Initializes a new item containing the specified system item.
- (Object) initWithCustomView(customView)
Initializes a new item using the specified custom view. The bar button item created by this method does not call the action method of its target in response to user interactions. Instead, the bar button item expects the specified custom view to handle any user interactions and provide an appropriate response.
- (Object) initWithImage(image, landscapeImagePhone:landscapeImagePhone, style:style, target:target, action:action)
Initializes a new item using the specified images and other properties.
- (Object) initWithImage(image, style:style, target:target, action:action)
Initializes a new item using the specified image and other properties.
- (Object) initWithTitle(title, style:style, target:target, action:action)
Initializes a new item using the specified title and other properties.
- (Object) setBackButtonBackgroundImage(backgroundImage, forState:state, barMetrics:barMetrics)
Sets the back button background image for a given control state and bar metrics This modifier applies only to navigation bar back buttons and is ignored by other buttons.For good results, backgroundImage must be a stretchable image.
- (Object) setBackButtonBackgroundVerticalPositionAdjustment(adjustment, forBarMetrics:barMetrics)
Sets the back button vertical position offset for given bar metrics. This modifier applies only to navigation bar back buttons and is ignored by other buttons.This offset is used to adjust the vertical centering of bordered bar buttons within the bar.
- (Object) setBackButtonTitlePositionAdjustment(adjustment, forBarMetrics:barMetrics)
Sets the back button title offset for given bar metrics This modifier applies only to navigation bar back buttons and is ignored by other buttons.
- (Object) setBackgroundImage(backgroundImage, forState:state, barMetrics:barMetrics)
Sets the background image for a given state and bar metrics. For good results, backgroundImage must be a stretchable image.
- (Object) setBackgroundImage(backgroundImage, forState:state, style:style, barMetrics:barMetrics)
Sets the background image for the specified state, style, and metrics. For good results, backgroundImage must be a stretchable image.
- (Object) setBackgroundVerticalPositionAdjustment(adjustment, forBarMetrics:barMetrics)
Sets the background vertical position offset for given bar metrics. This offset is used to adjust the vertical centering of bordered bar buttons within the bar.
- (Object) setTitlePositionAdjustment(adjustment, forBarMetrics:barMetrics)
Sets the title offset for given bar metrics. This offset is used to adjust the position of a title (if any) within a bordered bar button.
- (UIOffset) titlePositionAdjustmentForBarMetrics(barMetrics)
Returns the title offset for given bar metrics. This offset is used to adjust the position of a title (if any) within a bordered bar button.