Class: BetterToolbar::Item

Inherits:
Object
  • Object
show all
Defined in:
lib/better_toolbar/item.rb

Class Method Summary collapse

Class Method Details

.create(options) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# 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