Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
73 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.repl_history | ||
build | ||
vendor | ||
resources | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
source 'https://rubygems.org' | ||
|
||
gem "rake" | ||
gem "ProMotion", "~> 2.4.2" | ||
gem "ProMotion-menu" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# -*- coding: utf-8 -*- | ||
$:.unshift("/Library/RubyMotion/lib") | ||
require 'motion/project/template/ios' | ||
|
||
begin | ||
require 'bundler' | ||
Bundler.require | ||
rescue LoadError | ||
end | ||
|
||
Motion::Project::App.setup do |app| | ||
# Use `rake config' to see complete project settings. | ||
app.name = 'SimpleMenu' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class AppDelegate < PM::Delegate | ||
def on_load(app, options) | ||
open_menu HomeScreen.new(nav_bar: true), left: NavigationScreen, to_show: :pan_nav_bar, to_hide: [:pan_nav_bar, :tap_nav_bar, :tap_center] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class HomeScreen < PM::Screen | ||
title "Home" | ||
|
||
def on_load | ||
set_nav_bar_button :left, title: "Menu", action: :nav_left_button | ||
end | ||
|
||
def nav_left_button | ||
# toggle left will allow the nav button to open and close the menu | ||
app_delegate.menu.toggle_left | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
class NavigationScreen < ProMotion::TableScreen | ||
|
||
def table_data | ||
[{ | ||
title: nil, | ||
cells: [{ | ||
title: 'Home', | ||
action: :swap_center_controller, | ||
arguments: HomeScreen | ||
}] | ||
}] | ||
end | ||
|
||
def swap_center_controller(screen_class) | ||
# Just use screen_class if you don't need a navigation bar | ||
app_delegate.menu.center_controller = screen_class.new(nav_bar: true) | ||
app_delegate.menu.toggle_left | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
describe "Application 'SimpleMenu'" do | ||
before do | ||
@app = UIApplication.sharedApplication | ||
end | ||
|
||
it "has one window" do | ||
@app.windows.size.should == 1 | ||
end | ||
end |