{"ts":1347898745792,"silentsave":true,"restoring":false,"patch":[[{"diffs":[[1,"module ProMotion\n # Instance methods\n class Screen\n include ProMotion::ScreenNavigation\n include ProMotion::ScreenElements\n \n attr_accessor :view_controller, :navigation_controller, :parent_screen, :first_screen, :tab_bar_item, :tab_bar, :modal\n\n def initialize(args = {})\n args.each do |k, v|\n self.send \"#{k}=\", v if self.respond_to?(\"#{k}=\")\n end\n self.load_view_controller\n self.view_controller.title = self.title\n\n self.add_nav_bar if args[:nav_bar]\n self.on_init if self.respond_to?(:on_init)\n self\n end\n\n def is_modal?\n self.modal == true\n end\n\n def has_nav_bar?\n self.navigation_controller.nil? != true\n end\n\n # Note: this is overridden in TableScreen\n def load_view_controller\n self.view_controller ||= ViewController\n end\n\n def set_tab_bar_item(args = {})\n self.tab_bar_item = args\n refresh_tab_bar_item\n end\n\n def refresh_tab_bar_item\n self.main_controller.tabBarItem = ProMotion::TabBar.tab_bar_item(self.tab_bar_item) if self.tab_bar_item\n end\n \n def add_nav_bar\n self.navigation_controller = NavigationController.alloc.initWithRootViewController(self.view_controller)\n self.first_screen = true\n end\n\n def set_nav_bar_right_button(title, args={})\n args[:style] ||= UIBarButtonItemStyleBordered\n args[:target] ||= self\n args[:action] ||= nil\n\n right_button = UIBarButtonItem.alloc.initWithTitle(title, style: args[:style], target: args[:target], action: args[:action])\n self.view_controller.navigationItem.rightBarButtonItem = right_button\n right_button\n end\n\n def set_nav_bar_left_button(title, args={})\n args[:style] ||= UIBarButtonItemStyleBordered\n args[:target] ||= self\n args[:action] ||= nil\n\n left_button = UIBarButtonItem.alloc.initWithTitle(title, style: args[:style], target: args[:target], action: args[:action])\n self.view_controller.navigationItem.leftBarButtonItem = left_button\n left_button\n end\n\n def view_controller=(vc)\n vc = vc.alloc.initWithNibName(nil, bundle:nil) if vc.respond_to?(:alloc)\n if self.navigation_controller && self.first_screen?\n @view_controller = vc\n self.navigation_controller = NavigationController.alloc.initWithRootViewController(self.view_controller)\n else\n @view_controller = vc\n end\n @view_controller.screen = self if @view_controller.respond_to?(\"screen=\")\n\n refresh_tab_bar_item\n end\n\n def first_screen?\n self.first_screen == true\n end\n\n def set_view_controller(vc)\n self.view_controller = vc\n end\n\n def view_will_appear(animated)\n self.will_appear if self.respond_to?(:will_appear)\n end\n\n def view_did_appear(animated)\n self.on_appear if self.respond_to?(:on_appear)\n end\n\n def title\n self.class.send :get_title\n end\n\n def title=(new_title)\n self.class.title = new_title\n self.view_controller.title = new_title\n end\n\n def main_controller\n return self.navigation_controller if self.navigation_controller\n self.view_controller\n end\n\n end\n \n # Class methods\n class Screen\n class << self\n def title(t)\n @title = t\n end\n def title=(t)\n @title = t\n end\n def get_title\n @title ||= self.to_s\n end\n end\n end\nend"]],"start1":0,"start2":0,"length1":0,"length2":3387}]],"length":3387} {"contributors":[],"silentsave":false,"ts":1347898870641,"patch":[[{"diffs":[[0,"lements\n"],[-1," "],[0,"\n att"]],"start1":123,"start2":123,"length1":20,"length2":16},{"diffs":[[0," end\n"],[-1," "],[0,"\n def"]],"start1":1070,"start2":1070,"length1":20,"length2":16},{"diffs":[[0,"\n\n end\n"],[-1," "],[0,"\n # Cla"]],"start1":3144,"start2":3144,"length1":18,"length2":16}]],"length":3377,"saved":false}