Sha256: ef210afb1e342d985c0e0e0b30f49b0f9da0e306db88eabdfa4a2162c6cad281

Contents?: true

Size: 1.82 KB

Versions: 12

Compression:

Stored size: 1.82 KB

Contents

class FirstController < UIViewController

  stylesheet :first

  layout :root do
    subview(CustomView, :background) do
      @welcome = subview(UILabel, :welcome)
      subview(UILabel, :footer)
      @button = subview(UIButton.buttonWithType(UIButtonTypeRoundedRect), :next_message)
    end

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

  # used in testing
  def landscape_only
    UIApplication.sharedApplication.windows[0].rootViewController = LandscapeOnlyController.alloc.init
  end

  def next_view
    landscape_only
  end

  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

  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

  def shouldAutorotateToInterfaceOrientation(orientation)
    autorotateToOrientation(orientation)
  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
teacup-0.3.12 app/controllers/first_controller.rb
teacup-0.3.11 app/controllers/first_controller.rb
teacup-0.3.10 app/controllers/first_controller.rb
teacup-0.3.9 app/controllers/first_controller.rb
teacup-0.3.8 app/controllers/first_controller.rb
teacup-0.3.7 app/controllers/first_controller.rb
teacup-0.3.6 app/controllers/first_controller.rb
teacup-0.3.5 app/controllers/first_controller.rb
teacup-0.3.4 app/controllers/first_controller.rb
teacup-0.3.3 app/controllers/first_controller.rb
teacup-0.3.2 app/controllers/first_controller.rb
teacup-0.3.1 app/controllers/first_controller.rb