Method: ProMotion::ScreenModule#set_nav_bar_button
- Defined in:
- lib/ProMotion/screens/_screen_module.rb
#set_nav_bar_button(side, args = {}) ⇒ Object
If you call set_nav_bar_button with a nil title and system_icon: UIBarButtonSystemItemAdd (or any other system icon), the button is initialized with a barButtonSystemItem instead of a title.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/ProMotion/screens/_screen_module.rb', line 79 def (side, args={}) args[:style] ||= UIBarButtonItemStyleBordered args[:target] ||= self args[:action] ||= nil = case args[:title] when String UIBarButtonItem.alloc.initWithTitle(args[:title], style: args[:style], target: args[:target], action: args[:action]) when UIImage UIBarButtonItem.alloc.initWithImage(args[:title], style: args[:style], target: args[:target], action: args[:action]) when Symbol, NilClass UIBarButtonItem.alloc.initWithBarButtonSystemItem(args[:system_icon], target: args[:target], action: args[:action]) if args[:system_icon] when UIBarButtonItem args[:title] else PM.logger.error("Please supply a title string, a UIImage or :system.") end self..leftBarButtonItem = if side == :left self..rightBarButtonItem = if side == :right end |