ProMotion 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. data/.gitignore +14 -22
  2. data/.repl_history +0 -0
  3. data/Gemfile.lock +14 -0
  4. data/ProMotion.gemspec +4 -3
  5. data/README.md +252 -25
  6. data/Rakefile +5 -3
  7. data/app/app_delegate.rb +2 -2
  8. data/app/screens/home_screen.rb +14 -3
  9. data/app/screens/test_screen.rb +19 -3
  10. data/lib/ProMotion.rb +0 -8
  11. data/lib/ProMotion/version.rb +1 -1
  12. metadata +32 -31
  13. data/.c9revisions/lib/ProMotion.rb.c9save +0 -1
  14. data/.c9revisions/lib/ProMotion/AppDelegate.rb.c9save +0 -3
  15. data/.c9revisions/lib/ProMotion/classes/Screen.rb.c9save +0 -2
  16. data/lib/ProMotion/AppDelegate.rb +0 -60
  17. data/lib/ProMotion/Console.rb +0 -19
  18. data/lib/ProMotion/ProMotion.rb +0 -3
  19. data/lib/ProMotion/_ext/NavigationController.rb +0 -7
  20. data/lib/ProMotion/_ext/TableViewCell.rb +0 -16
  21. data/lib/ProMotion/_ext/TableViewController.rb +0 -54
  22. data/lib/ProMotion/_ext/ViewController.rb +0 -68
  23. data/lib/ProMotion/_modules/ScreenElements.rb +0 -31
  24. data/lib/ProMotion/_modules/ScreenNavigation.rb +0 -149
  25. data/lib/ProMotion/classes/Element.rb +0 -14
  26. data/lib/ProMotion/classes/Screen.rb +0 -206
  27. data/lib/ProMotion/classes/TableScreen.rb +0 -52
  28. data/lib/ProMotion/helpers/MeasureHelper.rb +0 -18
  29. data/lib/ProMotion/helpers/TabBar.rb +0 -99
  30. data/lib/ProMotion/helpers/ViewHelper.rb +0 -23
  31. data/lib/ProMotion/helpers/motion-table/1st/searchable_table.rb +0 -58
  32. data/lib/ProMotion/helpers/motion-table/1st/sectioned_table.rb +0 -219
  33. data/lib/ProMotion/helpers/motion-table/2nd/grouped_table.rb +0 -12
  34. data/lib/ProMotion/helpers/motion-table/2nd/plain_table.rb +0 -13
  35. data/lib/ProMotion/helpers/motion-table/console.rb +0 -26
  36. data/lib/ProMotion/helpers/system_helper.rb +0 -29
data/app/app_delegate.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  class AppDelegate < ProMotion::AppDelegateParent
2
2
  def on_load(app, options)
3
- open_screen TestScreen, nav_bar: true
3
+ open_tab_bar HomeScreen.new(nav_bar: true), TestScreen.new(nav_bar:true)
4
4
  end
5
- end
5
+ end
@@ -2,9 +2,20 @@ class HomeScreen < ProMotion::Screen
2
2
  title "Home Screen"
3
3
 
4
4
  def on_load
5
- @label = add_view UILabel.alloc.initWithFrame(CGRectMake(5, 5, 20, 20)), {
6
- text: "This is awesome!",
7
- font: UIFont.UIFont.systemFontOfSize(18)
5
+ @label = add_view UILabel.alloc.initWithFrame(CGRectZero), {
6
+ text: "Working...",
7
+ font: UIFont.systemFontOfSize(18),
8
+ textColor: UIColor.blackColor
8
9
  }
10
+
11
+ self.view.backgroundColor = UIColor.whiteColor
12
+ self.set_nav_bar_right_button "Test", action: :test_it
13
+ end
14
+
15
+ def on_appear
16
+ end
17
+
18
+ def test_it
19
+ open TestScreen
9
20
  end
10
21
  end
@@ -1,10 +1,26 @@
1
- class TestScreen < ProMotion::TableScreen
1
+ class TestScreen < ProMotion::Screen
2
2
  title "Test Screen"
3
3
 
4
4
  def on_load
5
- @label = add_view UILabel.alloc.initWithFrame(CGRectMake(5, 5, 20, 20)), {
5
+ @label = add_element UILabel.alloc.initWithFrame(CGRectMake(5, 5, 320, 30)), {
6
6
  text: "This is awesome!",
7
- font: UIFont.UIFont.systemFontOfSize(18)
7
+ font: UIFont.systemFontOfSize(18)
8
8
  }
9
+ @button = add_element UIButton.alloc.initWithFrame([[5,45], [300, 40]]), {
10
+ title: "Button",
11
+ "addTarget:action:forControlEvents:" => [self, :hello, UIControlEventTouchUpInside],
12
+ backgroundColor: UIColor.whiteColor
13
+ }
14
+ @button.addSubview(@label)
15
+
16
+ set_nav_bar_right_button "Close", action: :close_this if self.parent_screen
17
+ end
18
+
19
+ def close_this
20
+ close
21
+ end
22
+
23
+ def hello
24
+ puts "hello"
9
25
  end
10
26
  end
data/lib/ProMotion.rb CHANGED
@@ -5,13 +5,5 @@ end
5
5
  require "ProMotion/version"
6
6
 
7
7
  Motion::Project::App.setup do |app|
8
-
9
- # Dir.glob(File.join(File.dirname(__FILE__), "ProMotion/**/*.rb")).each do |file|
10
- # app.files.unshift(file)
11
- # end
12
8
  app.files = Dir.glob(File.join(File.dirname(__FILE__), 'ProMotion/**/*.rb')) | app.files
13
- app.files = Dir.glob(File.join(File.dirname(__FILE__), 'ProMotion/helpers/**/*.rb')) | app.files
14
- app.files = Dir.glob(File.join(File.dirname(__FILE__), 'ProMotion/modules/**/*.rb')) | app.files
15
- app.files = Dir.glob(File.join(File.dirname(__FILE__), 'ProMotion/ext/**/*.rb')) | app.files
16
-
17
9
  end
@@ -1,3 +1,3 @@
1
1
  module ProMotion
2
- VERSION = "0.3.0" unless defined?(ProMotion::VERSION)
2
+ VERSION = "0.4.0" unless defined?(ProMotion::VERSION)
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ProMotion
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,20 +11,21 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-12-03 00:00:00.000000000 Z
14
+ date: 2013-02-05 00:00:00.000000000 Z
15
15
  dependencies: []
16
- description: ProMotion is a new way to organize RubyMotion apps.
16
+ description: ProMotion is a new way to easily build RubyMotion iOS apps.
17
17
  email:
18
18
  - jamon@clearsightstudio.com
19
+ - silas@clearsightstudio.com
20
+ - contact@clearsightstudio.com
19
21
  executables: []
20
22
  extensions: []
21
23
  extra_rdoc_files: []
22
24
  files:
23
- - .c9revisions/lib/ProMotion.rb.c9save
24
- - .c9revisions/lib/ProMotion/AppDelegate.rb.c9save
25
- - .c9revisions/lib/ProMotion/classes/Screen.rb.c9save
26
25
  - .gitignore
26
+ - .repl_history
27
27
  - Gemfile
28
+ - Gemfile.lock
28
29
  - LICENSE
29
30
  - ProMotion.gemspec
30
31
  - README.md
@@ -34,28 +35,28 @@ files:
34
35
  - app/screens/test_screen.rb
35
36
  - lib/ProMotion.rb
36
37
  - lib/ProMotion/.DS_Store
37
- - lib/ProMotion/AppDelegate.rb
38
- - lib/ProMotion/Console.rb
39
- - lib/ProMotion/ProMotion.rb
40
- - lib/ProMotion/_ext/NavigationController.rb
41
- - lib/ProMotion/_ext/TableViewCell.rb
42
- - lib/ProMotion/_ext/TableViewController.rb
43
- - lib/ProMotion/_ext/ViewController.rb
44
- - lib/ProMotion/_modules/ScreenElements.rb
45
- - lib/ProMotion/_modules/ScreenNavigation.rb
46
- - lib/ProMotion/classes/.DS_Store
47
- - lib/ProMotion/classes/Element.rb
48
- - lib/ProMotion/classes/Screen.rb
49
- - lib/ProMotion/classes/TableScreen.rb
50
- - lib/ProMotion/helpers/MeasureHelper.rb
51
- - lib/ProMotion/helpers/TabBar.rb
52
- - lib/ProMotion/helpers/ViewHelper.rb
53
- - lib/ProMotion/helpers/motion-table/1st/searchable_table.rb
54
- - lib/ProMotion/helpers/motion-table/1st/sectioned_table.rb
55
- - lib/ProMotion/helpers/motion-table/2nd/grouped_table.rb
56
- - lib/ProMotion/helpers/motion-table/2nd/plain_table.rb
57
- - lib/ProMotion/helpers/motion-table/console.rb
58
- - lib/ProMotion/helpers/system_helper.rb
38
+ - lib/ProMotion/_cocoatouch/NavigationController.rb
39
+ - lib/ProMotion/_cocoatouch/TableViewCell.rb
40
+ - lib/ProMotion/_cocoatouch/TableViewController.rb
41
+ - lib/ProMotion/_cocoatouch/ViewController.rb
42
+ - lib/ProMotion/_helpers/console.rb
43
+ - lib/ProMotion/_helpers/measure_helper.rb
44
+ - lib/ProMotion/_helpers/motion-table/1st/searchable_table.rb
45
+ - lib/ProMotion/_helpers/motion-table/1st/sectioned_table.rb
46
+ - lib/ProMotion/_helpers/motion-table/2nd/grouped_table.rb
47
+ - lib/ProMotion/_helpers/motion-table/2nd/plain_table.rb
48
+ - lib/ProMotion/_helpers/system_helper.rb
49
+ - lib/ProMotion/_helpers/tab_bar.rb
50
+ - lib/ProMotion/_helpers/view_helper.rb
51
+ - lib/ProMotion/_screen_modules/screen_elements.rb
52
+ - lib/ProMotion/_screen_modules/screen_navigation.rb
53
+ - lib/ProMotion/_screen_modules/screen_tabs.rb
54
+ - lib/ProMotion/app_delegate.rb
55
+ - lib/ProMotion/pro_motion.rb
56
+ - lib/ProMotion/screen/_screen_module.rb
57
+ - lib/ProMotion/screen/_table_screen_module.rb
58
+ - lib/ProMotion/screen/screen.rb
59
+ - lib/ProMotion/screen/table_screen.rb
59
60
  - lib/ProMotion/version.rb
60
61
  homepage: https://github.com/clearsightstudio/ProMotion
61
62
  licenses: []
@@ -77,11 +78,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
78
  version: '0'
78
79
  requirements: []
79
80
  rubyforge_project:
80
- rubygems_version: 1.8.22
81
+ rubygems_version: 1.8.24
81
82
  signing_key:
82
83
  specification_version: 3
83
84
  summary: ProMotion is a new way to organize RubyMotion apps. Instead of dealing with
84
85
  UIViewControllers, you work with Screens. Screens are a logical way to think of
85
- your app -- similar in some ways to Storyboards.
86
+ your app and include a ton of great utilities to make iOS development more like
87
+ Ruby and less like Objective-C.
86
88
  test_files: []
87
- has_rdoc:
@@ -1 +0,0 @@
1
- {"ts":1347898586630,"silentsave":true,"restoring":false,"patch":[[{"diffs":[[1,"unless defined?(Motion::Project::Config)\n raise \"This file must be required within a RubyMotion project Rakefile.\"\nend\n\nrequire \"ProMotion/version\"\n\nMotion::Project::App.setup do |app|\n\n # Dir.glob(File.join(File.dirname(__FILE__), \"ProMotion/**/*.rb\")).each do |file|\n # app.files.unshift(file)\n # end\n app.files = Dir.glob(File.join(File.dirname(__FILE__), 'ProMotion/**/*.rb')) | app.files\n app.files = Dir.glob(File.join(File.dirname(__FILE__), 'ProMotion/helpers/**/*.rb')) | app.files\n app.files = Dir.glob(File.join(File.dirname(__FILE__), 'ProMotion/modules/**/*.rb')) | app.files\n app.files = Dir.glob(File.join(File.dirname(__FILE__), 'ProMotion/ext/**/*.rb')) | app.files\n \nend"]],"start1":0,"start2":0,"length1":0,"length2":699}]],"length":699}
@@ -1,3 +0,0 @@
1
- {"ts":1347924907908,"silentsave":true,"restoring":false,"patch":[[{"diffs":[[1,"module ProMotion\n class AppDelegateParent\n attr_accessor :window\n \n def application(application, didFinishLaunchingWithOptions:launchOptions)\n return true if RUBYMOTION_ENV == \"test\"\n\n Console.log(\" Your AppDelegate (usually in app_delegate.rb) needs an on_load(options) method.\", withColor: Console::RED_COLOR) unless self.respond_to?(:on_load)\n \n on_load launchOptions\n\n open_home_screen if has_home_screen\n\n get_home_screen.on_opened if has_home_screen && get_home_screen.respond_to?(:on_opened)\n \n true\n end\n\n def app_delegate\n UIApplication.sharedApplication.delegate\n end\n\n def app_window\n self.app_delegate.window\n end\n\n def load_root_view(new_view)\n self.window ||= UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)\n self.window.rootViewController = new_view\n self.window.makeKeyAndVisible\n end\n\n def open_screen(screen)\n home(screen)\n end\n\n def home(screen)\n screen = screen.new if screen.respond_to? :new\n @home_screen = screen\n end\n\n def fresh_start(new_screen)\n home(new_screen)\n open_home_screen\n end\n\n def open_home_screen\n get_home_screen.send(:on_load) if get_home_screen.respond_to?(:on_load)\n load_root_view get_home_screen.main_controller\n end\n \n def get_home_screen\n @home_screen\n end\n\n def has_home_screen\n @home_screen.nil? == false\n end\n end\nend"]],"start1":0,"start2":0,"length1":0,"length2":1456}]],"length":1456}
2
- {"contributors":[],"silentsave":false,"ts":1347925005943,"patch":[[{"diffs":[[0,"_to?"],[-1," "],[1,"("],[0,":new"],[1,")s"],[0,"\n "]],"start1":1027,"start2":1027,"length1":13,"length2":15}]],"length":1458,"saved":false}
3
- {"ts":1347925017979,"patch":[[{"diffs":[[0,"o?(:new)"],[-1,"s"],[0,"\n @"]],"start1":1029,"start2":1029,"length1":17,"length2":16}]],"length":1457,"saved":false}
@@ -1,2 +0,0 @@
1
- {"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}
2
- {"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}
@@ -1,60 +0,0 @@
1
- module ProMotion
2
- class AppDelegateParent
3
- attr_accessor :window
4
-
5
- def application(application, didFinishLaunchingWithOptions:launchOptions)
6
- return true if RUBYMOTION_ENV == "test"
7
-
8
- Console.log(" Your AppDelegate (usually in app_delegate.rb) needs an on_load(options) method.", withColor: Console::RED_COLOR) unless self.respond_to?(:on_load)
9
-
10
- on_load(application, launchOptions)
11
-
12
- open_home_screen if has_home_screen
13
-
14
- get_home_screen.on_opened if has_home_screen && get_home_screen.respond_to?(:on_opened)
15
-
16
- true
17
- end
18
-
19
- def app_delegate
20
- UIApplication.sharedApplication.delegate
21
- end
22
-
23
- def app_window
24
- self.app_delegate.window
25
- end
26
-
27
- def load_root_view(new_view)
28
- self.window ||= UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
29
- self.window.rootViewController = new_view
30
- self.window.makeKeyAndVisible
31
- end
32
-
33
- def open_screen(screen)
34
- home(screen)
35
- end
36
-
37
- def home(screen)
38
- screen = screen.new if screen.respond_to?(:new)
39
- @home_screen = screen
40
- end
41
-
42
- def fresh_start(new_screen)
43
- home(new_screen)
44
- open_home_screen
45
- end
46
-
47
- def open_home_screen
48
- get_home_screen.send(:on_load) if get_home_screen.respond_to?(:on_load)
49
- load_root_view get_home_screen.main_controller
50
- end
51
-
52
- def get_home_screen
53
- @home_screen
54
- end
55
-
56
- def has_home_screen
57
- @home_screen.nil? == false
58
- end
59
- end
60
- end
@@ -1,19 +0,0 @@
1
- module ProMotion
2
- class Console
3
- NAME = "RubyMotion::Console"
4
- DEFAULT_COLOR = [ '', '' ]
5
- RED_COLOR = [ "\e[0;31m", "\e[0m" ] # Must be in double quotes
6
- GREEN_COLOR = [ "\e[0;32m", "\e[0m" ]
7
- PURPLE_COLOR = [ "\e[0;35m", "\e[0m" ]
8
-
9
- class << self
10
- def log(log, withColor:color)
11
- puts color[0] + NAME + log + color[1]
12
- end
13
-
14
- def log(log)
15
- log(log, withColor: DEFAULT_COLOR)
16
- end
17
- end
18
- end
19
- end
@@ -1,3 +0,0 @@
1
- module Promotion
2
- end
3
- ::PM = ProMotion unless defined?(::PM)
@@ -1,7 +0,0 @@
1
- module ProMotion
2
- class NavigationController < UINavigationController
3
- def dealloc
4
- $stderr.puts "Deallocating #{self.to_s}" if ProMotion::Screen.debug_mode
5
- end
6
- end
7
- end
@@ -1,16 +0,0 @@
1
- module ProMotion
2
- class TableViewCell < UITableViewCell
3
- attr_accessor :image_size
4
-
5
- def layoutSubviews
6
- super
7
-
8
- if self.image_size && self.imageView.image && self.imageView.image.size && self.imageView.image.size.width > 0
9
- f = self.imageView.frame
10
- size_inset_x = (self.imageView.size.width - self.image_size) / 2
11
- size_inset_y = (self.imageView.size.height - self.image_size) / 2
12
- self.imageView.frame = CGRectInset(f, size_inset_x, size_inset_y)
13
- end
14
- end
15
- end
16
- end
@@ -1,54 +0,0 @@
1
- module ProMotion
2
- class TableViewController < UITableViewController
3
- attr_accessor :screen
4
-
5
- def viewDidLoad
6
- super
7
- self.screen.view_did_load if self.screen && self.screen.respond_to?(:view_did_load)
8
- end
9
-
10
- def viewWillAppear(animated)
11
- super
12
- self.screen.view_will_appear(animated) if self.screen && self.screen.respond_to?(:view_will_appear)
13
- end
14
-
15
- def viewDidAppear(animated)
16
- super
17
- self.screen.view_did_appear(animated) if self.screen && self.screen.respond_to?(:view_did_appear)
18
- end
19
-
20
- def viewWillDisappear(animated)
21
- if self.screen && self.screen.respond_to?(:view_will_disappear)
22
- self.screen.view_will_disappear(animated)
23
- end
24
- super
25
- end
26
-
27
- def viewDidDisappear(animated)
28
- if self.screen && self.screen.respond_to?(:view_did_disappear)
29
- self.screen.view_did_disappear(animated)
30
- end
31
- super
32
- end
33
-
34
- def shouldAutorotateToInterfaceOrientation(orientation)
35
- self.screen.should_rotate(orientation)
36
- end
37
-
38
- def shouldAutorotate
39
- self.screen.should_autorotate
40
- end
41
-
42
- def willRotateToInterfaceOrientation(orientation, duration:duration)
43
- self.screen.will_rotate(orientation, duration)
44
- end
45
-
46
- def didRotateFromInterfaceOrientation(orientation)
47
- self.screen.on_rotate
48
- end
49
-
50
- def dealloc
51
- $stderr.puts "Deallocating #{self.to_s}" if ProMotion::Screen.debug_mode
52
- end
53
- end
54
- end
@@ -1,68 +0,0 @@
1
- module ProMotion
2
- class ViewController < UIViewController
3
- attr_accessor :screen
4
-
5
- def viewDidLoad
6
- super
7
- if screen_will_respond_to?(:view_did_load)
8
- self.screen.view_did_load
9
- end
10
- end
11
-
12
- def viewWillAppear(animated)
13
- super
14
- if screen_will_respond_to?(:view_will_appear)
15
- self.screen.view_will_appear(animated)
16
- end
17
- end
18
-
19
- def viewDidAppear(animated)
20
- super
21
- if screen_will_respond_to?(:view_did_appear)
22
- self.screen.view_did_appear(animated)
23
- end
24
- end
25
-
26
- def viewWillDisappear(animated)
27
- if screen_will_respond_to?(:view_will_disappear)
28
- self.screen.view_will_disappear(animated)
29
- end
30
- super
31
- end
32
-
33
- def viewDidDisappear(animated)
34
- if screen_will_respond_to?(:view_did_disappear)
35
- self.screen.view_did_disappear(animated)
36
- end
37
- super
38
- end
39
-
40
- def screen_will_respond_to?(method)
41
- self.screen && self.screen.respond_to?(method)
42
- end
43
-
44
- def shouldAutorotateToInterfaceOrientation(orientation)
45
- self.screen.should_rotate(orientation)
46
- end
47
-
48
- def shouldAutorotate
49
- self.screen.should_autorotate
50
- end
51
-
52
- def supportedInterfaceOrientations
53
- self.screen.supported_orientations
54
- end
55
-
56
- def willRotateToInterfaceOrientation(orientation, duration:duration)
57
- self.screen.will_rotate(orientation, duration)
58
- end
59
-
60
- def didRotateFromInterfaceOrientation(orientation)
61
- self.screen.on_rotate
62
- end
63
-
64
- def dealloc
65
- $stderr.puts "Deallocating #{self.to_s}" if ProMotion::Screen.debug_mode
66
- end
67
- end
68
- end
@@ -1,31 +0,0 @@
1
- module ProMotion
2
- module ScreenElements
3
- include ProMotion::ViewHelper
4
-
5
- def add_element(view, attrs = {})
6
- if attrs.length > 0
7
- set_attributes(view, attrs)
8
- end
9
- self.view_controller.view.addSubview(view)
10
- view
11
- end
12
-
13
- def remove_element(view)
14
- view.removeFromSuperview
15
- view = nil
16
- nil
17
- end
18
-
19
- def bounds
20
- return self.view_controller.view.bounds
21
- end
22
-
23
- def frame
24
- return self.view_controller.view.frame
25
- end
26
-
27
- def view
28
- return self.view_controller.view
29
- end
30
- end
31
- end