UIViewController
extension UIViewController
-
Sets the Fiori Style items on
UIToolbar
This function only arranges items when the toolbar associated with the navigation controller is an instance of
FUIToolbar
, This function will convert the array ofUIButton
toUIBarButtonItem
array and use the standardsetToolbarItems
API to set the items to the toolbar.Note that Fiori only handles the button with text titles. For icon buttons, use
UIBarButtonItem
with image instead.If the toolbar associated with the navigation controller is not
FUIToolbar
, then the convertedUIBarButtonItem
array is used directly in the standardsetToolbarItems
API of theUIViewController
.When the
hasPrimaryActionItem
parameter istrue
, the buttons will be displayed from right-to-left for the left-to-right layout, and from left-to-right for the right-to-left layout.Declaration
Swift
public func setFioriStyleToolbarItems(_ buttons: [UIButton]?, helperText: String? = nil, hasPrimaryActionItem: Bool = false, animated: Bool)
Parameters
buttons
The array of buttons to be displayed in the
UIToolbar
. The first item in the array is the primary action button when thehasPrimaryActionItem
parameter istrue
.helperText
The helper text to be displayed in the
UIToolbar
.hasPrimaryActionItem
True if the first item is the primary action item.
animated
If true, animate the change of items in the toolbar.
-
Sets the Fiori Style items on
UIToolbar
This function only arranges items when the following conditions are met:
- The toolbar associated with the navigation controller is an instance of
FUIToolbar
. - All items are in the same type
- Text button type: the
customView
of theUIBarButtonItem
array elements are all UIButton with title text. - Icon type: The
UIBarButtonItem
array elements are all allUIBarButtonItem
with image.
- Text button type: the
If the toolbar associated with the navigation controller is not
FUIToolbar
, or the array contains different types, then theUIBarButtonItem
array is used directly in the standardsetToolbarItems
API of theUIViewController
.When
hasPrimaryActionItem
parameter is true, the buttons will be displayed from right to left for left-to-right layout, and from left to right for right-to-left layout.Declaration
Swift
public func setFioriStyleToolbarItems(_ toolbarItems: [UIBarButtonItem]?, helperText: String? = nil, hasPrimaryActionItem: Bool = false, animated: Bool)
Parameters
buttons
The array of
UIBarButtonItem
objects to be displayed in theUIToolbar
. The first item in the array is the primary action item when thehasPrimaryActionItem
parameter is true.helperText
The helper text to be displayed in the
UIToolbar
.hasPrimaryActionItem
True if the first item is the primary action item.
animated
If true, animate the change of items in the toolbar.
- The toolbar associated with the navigation controller is an instance of
-
Set
NSAttributedString
title and subtitle totitleView
of UINavigationItemDeclaration
Swift
public func setTitleView(_ attributedTitle: NSAttributedString, attributedSubtitle: NSAttributedString? = nil, withPopover: Bool = false)
Parameters
attributedTitle
NSAttributedString
title for thetitleView
attributedSubtitle
NSAttributedString
subtitle for thetitleView
; the default is nil.withPopover
true to show the full title and subtitle in popover once longpressed the
titleView
-
Set title and subtitle to
titleView
ofUINavigationItem
Declaration
Swift
public func setTitleView(_ title: String, subtitle: String? = nil, withPopover: Bool = false)
Parameters
title
title for the
titleView
subtitle
subtitle for the
titleView
; the default is nil.withPopover
true to show the full title and subtitle in the popover once the
titleView
has been longpressed.