Sha256: 481a49c2958122558487af90398a6d4057a9ba2b226ca68bb6fcb46c80ca6649

Contents?: true

Size: 819 Bytes

Versions: 3

Compression:

Stored size: 819 Bytes

Contents

class SplitViewController < UISplitViewController
  def master_screen
    s = self.viewControllers.first
    s.respond_to?(:visibleViewController) ? s.visibleViewController : s
  end
  def detail_screen
    s = self.viewControllers.last
    s.respond_to?(:visibleViewController) ? s.visibleViewController : s
  end
  def master_screen=(s)
    self.viewControllers = [s.main_controller, self.viewControllers.last]
  end
  def detail_screen=(s)
    # set the button from the old detail screen to the new one
    button = detail_screen.navigationItem.leftBarButtonItem
    s.navigationItem.leftBarButtonItem = button
    
    vc = s.respond_to?(:main_controller) ? s.main_controller : s

    self.viewControllers = [self.viewControllers.first, vc]
  end
  def screens=(s_array)
    self.viewControllers = s_array
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ProMotion-0.6.2 lib/ProMotion/cocoatouch/SplitViewController.rb
ProMotion-0.6.1 lib/ProMotion/cocoatouch/SplitViewController.rb
ProMotion-0.6.0 lib/ProMotion/cocoatouch/SplitViewController.rb