Sha256: ac928675ee2e2606edd7868a93e35e829b62fa441f05cf74ff38c44971e44886

Contents?: true

Size: 1.58 KB

Versions: 3

Compression:

Stored size: 1.58 KB

Contents

class DemoController < UIViewController
  stylesheet :demo_sheet

  attr_reader :status_bar

  layout :demo do
    @container = subview(UIView, :container) do
      @show_notice_button = subview(UIButton.buttonWithType(UIButtonTypeRoundedRect), :show_notice_button)
      @show_activity_button = subview(UIButton.buttonWithType(UIButtonTypeRoundedRect), :show_activity_button)
      @show_success_button = subview(UIButton.buttonWithType(UIButtonTypeRoundedRect), :show_success_button)
      @show_error_button = subview(UIButton.buttonWithType(UIButtonTypeRoundedRect), :show_error_button)
      @hide_notice_button = subview(UIButton.buttonWithType(UIButtonTypeRoundedRect), :hide_notice_button)
      @visibility_button = subview(UIButton.buttonWithType(UIButtonTypeRoundedRect), :visibility_button)
    end
  end

  def viewDidLoad
    super

    @status_bar = StatusBar::Base.new

    @show_notice_button.when(UIControlEventTouchUpInside) {
      @status_bar.show_notice "This is a notice"
    }

    @show_activity_button.when(UIControlEventTouchUpInside) {
      @status_bar.show_activity_notice "Something's going on"
    }

    @show_success_button.when(UIControlEventTouchUpInside) {
      @status_bar.show_success_notice "Wohoo... made it!"
    }

    @show_error_button.when(UIControlEventTouchUpInside) {
      @status_bar.show_error_notice "Aww... no go"
    }

    @hide_notice_button.when(UIControlEventTouchUpInside) {
      @status_bar.hide_notice
    }

    @visibility_button.when(UIControlEventTouchUpInside) {
      ap @status_bar.visible?
    }
  end

  def shouldAutorotate
    true
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
status_bar-0.2.3 app/controllers/demo_controller.rb
status_bar-0.2.2 app/controllers/demo_controller.rb
status_bar-0.2.1 app/controllers/demo_controller.rb