AUBarButtonItem in mPaaS is equivalent to UIBarButtonItem. It contains predefined items such as the color and font. To facilitate subsequent extension, AUBarButtonItem instead of UIBarButtonItem must be used in all mPaaS apps.
Currently, AUBarButtonItem completely is completely inherited from AUSwitch without any new properties or methods.
API description
/**
*/
@interface AUBarButtonItem : UIBarButtonItem
@property(nonatomic, strong) NSString *backButtonTitle; // The title of the Back button.
@property(nonatomic, strong) UIImage *backButtonImage; // The icon of the Back button.
@property(nonatomic, strong) UIColor *titleColor; // The text color of the Back button.
/**
* Set the spacing between buttons.
*
* @return Return an empty button of the UIBarButtonSystemItemFlexibleSpace style.
*/
+ (AUBarButtonItem *)flexibleSpaceItem;
/**
* Create a default Back button style.
*
* @param title The title to be displayed.
* @param target The tapping target.
* @param action The action to be executed upon tapping.
*
* @return APBarButtonItem
*/
+ (AUBarButtonItem *)backBarButtonItemWithTitle:(NSString *)title target:(id)target action:(SEL)action;
/**
* Create a default Back button style.
*
* @param title The title to be displayed.
* @param count The maximum number of characters to be displayed.
* @param target The tapping target.
* @param action The action to be executed upon tapping.
*
* @return APBarButtonItem
*/
+ (AUBarButtonItem *)backBarButtonItemWithTitle:(NSString *)title maxWordsCount:(NSInteger)count target:(id)target action:(SEL)action;
@end
Code sample
// Define a backBarItem.
// The backBarItem contains a back icon by default.
AUBarButtonItem *cancelItem = [AUBarButtonItem backBarButtonItemWithTitle:@"Back" target:self action:@selector(cancel)];
cancelItem.backButtonTitle = @"Cancel";
self.navigationItem.leftBarButtonItem = cancelItem;
AUBarButtonItem *rightItem1 = [[AUBarButtonItem alloc] initWithImage:image1 style:UIBarButtonItemStylePlain target:self action:@selector(rightBarItemPressed)];