Class: MainController

Inherits:
UIViewController show all
Defined in:
app/controllers/main_controller.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from UIViewController

#autorotateMask, #autorotateToOrientation, #top_level_view, #viewDidLoad, #willAnimateRotationToInterfaceOrientation

Methods included from Teacup::Controller

included, #layoutDidLoad, #stylesheet=, #teacupDidLoad

Methods included from Teacup::Layout

#auto, included, #layout, #stylesheet, #stylesheet=, #subview, #top_level_view

Instance Attribute Details

#buttonObject (readonly)

Returns the value of attribute button.



3
4
5
# File 'app/controllers/main_controller.rb', line 3

def button
  @button
end

#welcomeObject (readonly)

Returns the value of attribute welcome.



2
3
4
# File 'app/controllers/main_controller.rb', line 2

def welcome
  @welcome
end

Instance Method Details

#messagesObject



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'app/controllers/main_controller.rb', line 32

def messages
  @messages ||= [
    'This is teacup',
    'Welcome',
    'This is teacup',
    'Welcome to teacup',
    'You can do anything at teacup',
    'Anything at all',
    'The only limit is yourself ',
    'Welcome to teacup',
    'Welcome to teacup',
    'This is teacup',
    'Welcome to teacup',
    'This is teacup, Welcome',
    'Yes, this is teacup',
    'This is teacup and welcome to you who have come to teacup',
    'Anything is possible at teacup',
    'You can to anything teacup',
    'The infinite is possible at teacup',
    'The unattainable is unknown at teacup',
    'Welcome to teacup',
    'This is teacup',
    'Welcome to teacup',
    'Welcome',
    'This is teacup',
    'Welcome to teacup',
    'Welcome to teacup',
  ]
end

#next_messageObject



20
21
22
23
24
25
26
27
28
29
30
# File 'app/controllers/main_controller.rb', line 20

def next_message
  msg = messages.shift
  if msg
    @welcome.text = msg
  else
    @welcome.text = 'Next example...'

    @button.removeTarget(self, action: :next_view, forControlEvents:UIControlEventTouchUpInside)
    @button.addTarget(self, action: :next_view, forControlEvents:UIControlEventTouchUpInside)
  end
end

#next_viewObject



17
18
# File 'app/controllers/main_controller.rb', line 17

def next_view
end

#shouldAutorotateToInterfaceOrientation(orientation) ⇒ Object



62
63
64
# File 'app/controllers/main_controller.rb', line 62

def shouldAutorotateToInterfaceOrientation(orientation)
  autorotateToOrientation(orientation)
end