All Products
Search
Document Center

Mobile Platform as a Service:Navigation button

Last Updated:May 14, 2021

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

  1. /**
  2. */
  3. @interface AUBarButtonItem : UIBarButtonItem
  4. @property(nonatomic, strong) NSString *backButtonTitle; // The title of the Back button.
  5. @property(nonatomic, strong) UIImage *backButtonImage; // The icon of the Back button.
  6. @property(nonatomic, strong) UIColor *titleColor; // The text color of the Back button.
  7. /**
  8. * Set the spacing between buttons.
  9. *
  10. * @return Return an empty button of the UIBarButtonSystemItemFlexibleSpace style.
  11. */
  12. + (AUBarButtonItem *)flexibleSpaceItem;
  13. /**
  14. * Create a default Back button style.
  15. *
  16. * @param title The title to be displayed.
  17. * @param target The tapping target.
  18. * @param action The action to be executed upon tapping.
  19. *
  20. * @return APBarButtonItem
  21. */
  22. + (AUBarButtonItem *)backBarButtonItemWithTitle:(NSString *)title target:(id)target action:(SEL)action;
  23. /**
  24. * Create a default Back button style.
  25. *
  26. * @param title The title to be displayed.
  27. * @param count The maximum number of characters to be displayed.
  28. * @param target The tapping target.
  29. * @param action The action to be executed upon tapping.
  30. *
  31. * @return APBarButtonItem
  32. */
  33. + (AUBarButtonItem *)backBarButtonItemWithTitle:(NSString *)title maxWordsCount:(NSInteger)count target:(id)target action:(SEL)action;
  34. @end

Code sample

  1. // Define a backBarItem.
  2. // The backBarItem contains a back icon by default.
  3. AUBarButtonItem *cancelItem = [AUBarButtonItem backBarButtonItemWithTitle:@"Back" target:self action:@selector(cancel)];
  4. cancelItem.backButtonTitle = @"Cancel";
  5. self.navigationItem.leftBarButtonItem = cancelItem;
  6. AUBarButtonItem *rightItem1 = [[AUBarButtonItem alloc] initWithImage:image1 style:UIBarButtonItemStylePlain target:self action:@selector(rightBarItemPressed)];