Class: UIViewController

Inherits:
Object show all
Defined in:
lib/ios/sugarcube-modal/modal.rb,
lib/ios/sugarcube-ui/uiviewcontroller.rb,
lib/ios/sugarcube-to_s/uiviewcontroller.rb

Instance Method Summary collapse

Instance Method Details

#<<(view_controller) ⇒ Object

alias << push won't work. it doesn't "respect" subclasses overriding the push method.



10
11
12
# File 'lib/ios/sugarcube-ui/uiviewcontroller.rb', line 10

def <<(view_controller)
  push view_controller
end

#dismiss_modal(options = {}, &block) ⇒ Object



56
57
58
59
# File 'lib/ios/sugarcube-modal/modal.rb', line 56

def dismiss_modal(options={}, &block)
  options = options.merge(target: self)
  SugarCube::Modal.dismiss_modal(options, &block)
end

#popObject



14
15
16
17
18
19
# File 'lib/ios/sugarcube-ui/uiviewcontroller.rb', line 14

def pop
  to_pop = self.childViewControllers[-1]
  if to_pop
    to_pop.removeFromParentViewController
  end
end

#present_modal(view_ctlr, options = {}, &block) ⇒ Object



46
47
48
49
# File 'lib/ios/sugarcube-modal/modal.rb', line 46

def present_modal(view_ctlr, options={}, &block)
  options = options.merge(target: self)
  SugarCube::Modal.present_modal(view_ctlr, options, &block)
end

#present_modal_in_nav(view_ctlr, options = {}, &block) ⇒ Object



51
52
53
54
# File 'lib/ios/sugarcube-modal/modal.rb', line 51

def present_modal_in_nav(view_ctlr, options={}, &block)
  options = options.merge(target: self)
  SugarCube::Modal.present_modal_in_nav(view_ctlr, options, &block)
end

#push(view_controller) ⇒ Object



3
4
5
6
# File 'lib/ios/sugarcube-ui/uiviewcontroller.rb', line 3

def push(view_controller)
  self.addChildViewController(view_controller)
  self
end

#to_sObject



3
4
5
6
7
8
9
# File 'lib/ios/sugarcube-to_s/uiviewcontroller.rb', line 3

def to_s
  ret = super
  if self.presentingViewController
    ret += " presented by #{self.presentingViewController.to_s}"
  end
  ret
end