Class: Indoctrinator::Tutorial
- Inherits:
-
ICETutorialController
- Object
- ICETutorialController
- Indoctrinator::Tutorial
- Defined in:
- lib/project/tutorial.rb
Class Method Summary collapse
Instance Method Summary collapse
- #button1 ⇒ Object
- #button1=(button) ⇒ Object
- #button2 ⇒ Object
- #button2=(button) ⇒ Object
- #center_pager ⇒ Object
- #pages ⇒ Object
- #pages=(pages) ⇒ Object
- #remove(v) ⇒ Object
- #remove_buttons ⇒ Object
- #title ⇒ Object
- #title=(label) ⇒ Object
- #viewDidAppear(animated) ⇒ Object
Class Method Details
.new(pages, args = {}) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/project/tutorial.rb', line 4 def self.new(pages, args={}) tutorial = self.alloc.initWithNibName("ICETutorialController_iPhone", bundle: nil) tutorial.pages = pages tutorial.title = args[:title] tutorial. tutorial. = args[:button1] tutorial. = args[:button2] tutorial end |
Instance Method Details
#button1 ⇒ Object
51 52 53 |
# File 'lib/project/tutorial.rb', line 51 def @button1 end |
#button1=(button) ⇒ Object
46 47 48 49 |
# File 'lib/project/tutorial.rb', line 46 def () @button1 = self.view.addSubview @button1 end |
#button2 ⇒ Object
60 61 62 |
# File 'lib/project/tutorial.rb', line 60 def @button2 end |
#button2=(button) ⇒ Object
55 56 57 58 |
# File 'lib/project/tutorial.rb', line 55 def () @button2 = self.view.addSubview @button2 end |
#center_pager ⇒ Object
64 65 66 67 68 |
# File 'lib/project/tutorial.rb', line 64 def center_pager screen_size = UIScreen.mainScreen.bounds.size pc = self.view.subviews.find{ |v| v.is_a?(UIPageControl) } pc.frame = [[0, screen_size.height - 100],[screen_size.width, 36]] end |
#pages ⇒ Object
24 25 26 |
# File 'lib/project/tutorial.rb', line 24 def pages @pages end |
#pages=(pages) ⇒ Object
19 20 21 22 |
# File 'lib/project/tutorial.rb', line 19 def pages=(pages) @pages = pages self.setPages(Array(pages)) end |
#remove(v) ⇒ Object
70 71 72 73 |
# File 'lib/project/tutorial.rb', line 70 def remove(v) self.send(v).removeFromSuperview if self.send(v) && self.send(v).respond_to?(:removeFromSuperview) self.instance_variable_set "@#{v}", nil end |
#remove_buttons ⇒ Object
42 43 44 |
# File 'lib/project/tutorial.rb', line 42 def self.view.subviews.select{ |v| v.is_a?(UIButton) }.each(&:removeFromSuperview) end |
#title ⇒ Object
38 39 40 |
# File 'lib/project/tutorial.rb', line 38 def title @title ||= self.view.subviews.find{ |v| v.is_a?(UILabel) } end |
#title=(label) ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/project/tutorial.rb', line 28 def title=(label) return self.remove(:title) unless label if label.is_a?(String) self.title.text = label if self.title else self.remove(:title) self.view.addSubview label end end |
#viewDidAppear(animated) ⇒ Object
14 15 16 17 |
# File 'lib/project/tutorial.rb', line 14 def viewDidAppear(animated) super self.center_pager end |