class MotionWizard::IndexItem

Attributes

label[R]
label_wrapper[R]

Public Instance Methods

create_label() click to toggle source
# File lib/motion-wizard/views/index_item_view.rb, line 16
def create_label
  @label               = UILabel.alloc.init
  @label.textAlignment = NSTextAlignmentCenter
  @label.origin        = [0, 0]
end
create_label_wrapper() click to toggle source
# File lib/motion-wizard/views/index_item_view.rb, line 22
def create_label_wrapper
  @label_wrapper                 = UIView.alloc.init
  @label_wrapper.origin          = [0, 0]
  @label_wrapper.backgroundColor = UIColor.clearColor
end
init() click to toggle source
Calls superclass method
# File lib/motion-wizard/views/index_item_view.rb, line 5
def init
  super
  create_label
  create_label_wrapper
  @label_wrapper.addSubview(@label)
  addSubview(@label_wrapper)

  initialize_callbacks
  self
end
initialize_callbacks() click to toggle source
# File lib/motion-wizard/views/index_item_view.rb, line 28
def initialize_callbacks
  when_selected do
    @original_text = @label.text
    @label.text = "[#{@label.text}]"
  end

  when_unselected { @label.text = @original_text}
end
select() click to toggle source
# File lib/motion-wizard/views/index_item_view.rb, line 45
def select
  @when_selected.call
end
unselect() click to toggle source
# File lib/motion-wizard/views/index_item_view.rb, line 49
def unselect
  @when_unselected.call
end
when_selected(&block) click to toggle source
# File lib/motion-wizard/views/index_item_view.rb, line 37
def when_selected(&block)
  @when_selected = block
end
when_unselected(&block) click to toggle source
# File lib/motion-wizard/views/index_item_view.rb, line 41
def when_unselected(&block)
  @when_unselected = block
end