Class: UIControlController
- Inherits:
-
UIViewController
- Object
- UIViewController
- UIControlController
- Defined in:
- app/uicontrol_controller.rb
Instance Attribute Summary collapse
-
#button1 ⇒ Object
readonly
Returns the value of attribute button1.
-
#button2 ⇒ Object
readonly
Returns the value of attribute button2.
-
#event ⇒ Object
readonly
Returns the value of attribute event.
-
#touched ⇒ Object
readonly
Returns the value of attribute touched.
-
#touched_1 ⇒ Object
readonly
Returns the value of attribute touched_1.
-
#touched_2 ⇒ Object
readonly
Returns the value of attribute touched_2.
-
#touched_count ⇒ Object
readonly
Returns the value of attribute touched_count.
Instance Method Summary collapse
Methods inherited from UIViewController
#<<, #dismiss_modal, #pop, #present_modal, #present_modal_in_nav, #push, #sugarcube_cleanup, #to_s
Instance Attribute Details
#button1 ⇒ Object (readonly)
Returns the value of attribute button1.
2 3 4 |
# File 'app/uicontrol_controller.rb', line 2 def @button1 end |
#button2 ⇒ Object (readonly)
Returns the value of attribute button2.
3 4 5 |
# File 'app/uicontrol_controller.rb', line 3 def @button2 end |
#event ⇒ Object (readonly)
Returns the value of attribute event.
6 7 8 |
# File 'app/uicontrol_controller.rb', line 6 def event @event end |
#touched ⇒ Object (readonly)
Returns the value of attribute touched.
4 5 6 |
# File 'app/uicontrol_controller.rb', line 4 def touched @touched end |
#touched_1 ⇒ Object (readonly)
Returns the value of attribute touched_1.
7 8 9 |
# File 'app/uicontrol_controller.rb', line 7 def touched_1 @touched_1 end |
#touched_2 ⇒ Object (readonly)
Returns the value of attribute touched_2.
8 9 10 |
# File 'app/uicontrol_controller.rb', line 8 def touched_2 @touched_2 end |
#touched_count ⇒ Object (readonly)
Returns the value of attribute touched_count.
5 6 7 |
# File 'app/uicontrol_controller.rb', line 5 def touched_count @touched_count end |
Instance Method Details
#loadView ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'app/uicontrol_controller.rb', line 18 def loadView super.tap do @button1 = UIButton.rounded @button1.setTitle('one', forState: UIControlStateNormal) @button1.sizeToFit @button1.center = self.view.center self.view << @button1 @button2 = UIButton.rounded @button2.setTitle('two', forState: UIControlStateNormal) @button2.sizeToFit @button2.center = [@button1.center.x, @button1.center.y + 30] @button1.center = [@button1.center.x, @button1.center.y - 30] self.view << @button2 @button1.on :touch do |sender,event| @touched_1 = true @touched = sender @touched_count += 1 end @button2.on :touch do |sender,event| @touched_2 = true @touched = sender @touched_count += 1 end reset end end |
#reset ⇒ Object
10 11 12 13 14 15 16 |
# File 'app/uicontrol_controller.rb', line 10 def reset @touched = nil @touched_count = 0 @event = nil @touched_1 = false @touched_2 = false end |