class BetterToolbar::Item

Public Class Methods

create(options) click to toggle source
# File lib/better_toolbar/item.rb, line 3
def self.create(options)
  item = if options[:title]
    UIBarButtonItem.alloc.initWithTitle(
      options[:title],
      style: UIBarButtonItemStylePlain,
      target: nil,
      action: nil
    )
  else
    UIBarButtonItem.alloc.initWithImage(
      options[:image],
      style: UIBarButtonItemStylePlain,
      target: nil,
      action: nil
    )
  end

  item.target = options[:target]
  item.action = options[:action]

  item
end