I'm using ProMotion, BubbleWrap, Teacup, and GeoMotion. Having trouble finding the distance from the CGRectMake origin for the navbar to the right edge of the screen. I'd like to fit both portrait and landscape. Also having trouble putting a navbar across the whole top of the split screens, but I will settle to fix this problem first. Thank you.
Using Sublime text editor, the autocomplete seems to show me all available methods, no matter what I'm calling them on.
class AppDelegate < PM::Delegate
include PM::Styling
status_bar true, animation: :none
def on_load(app, options)
open_split_screen MenuScreen, DetailScreen
end
def set_appearance_defaults
UINavigationBar.appearance.tintColor = hex_color("61B637")
end
end
class MenuScreen < PM::TableScreen
searchable placeholder: "Search states"
title "Menu"
def table_data
[{
title: "",
cells: Menu.all.map { |state| { title: state.name, action: :tapped_state } }
}]
end
def tapped_state(args={})
PM.logger.debug args
end
def states_tapped
end
def help_tapped
end
end
class DetailScreen < PM::Screen
include DetailStyles
title "Detail"
def on_load
#UIScreen.mainScreen.bounds ???
width = ???
naviBarObj = UINavigationBar.alloc.initWithFrame(CGRectMake(0, 0, width, 44))
self.view.addSubview(naviBarObj)
cancelItem = UIBarButtonItem.alloc.
initWithTitle("Cancel",
style:UIBarButtonItemStyleBordered,
target:self,
action:'cancelButtonPressed')
doneItem = UIBarButtonItem.alloc.
initWithTitle("Done",
style:UIBarButtonItemStyleBordered,
target:self,
action:'doneButtonPressed')
navigItem = UINavigationItem.alloc.initWithTitle("Navigation Title")
navigItem.rightBarButtonItem = doneItem
navigItem.leftBarButtonItem = cancelItem
naviBarObj.items = NSArray.arrayWithObjects(navigItem, nil)
self.view.backgroundColor = BW.rgb_color(100, 150, 50)
end
def cancelButtonPressed
true
end
def doneButtonPressed
true
end
def states_tapped
true
end
def help_tapped
true
end
end