-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added add_child_screen and remove_child_screen methods. #677
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
|
@@ -25,45 +25,6 @@ def modal? | |
self.modal == true | ||
end | ||
|
||
def resolve_title | ||
case self.class.title_type | ||
when :text then self.title = self.class.title | ||
when :view then self.navigationItem.titleView = self.class.title | ||
when :image then self.navigationItem.titleView = UIImageView.alloc.initWithImage(self.class.title) | ||
else | ||
PM.logger.warn("title expects string, UIView, or UIImage, but #{self.class.title.class.to_s} given.") | ||
end | ||
end | ||
|
||
def resolve_status_bar | ||
case self.class.status_bar_type | ||
when :none | ||
status_bar_hidden true | ||
when :light | ||
status_bar_hidden false | ||
status_bar_style UIStatusBarStyleLightContent | ||
when :dark | ||
status_bar_hidden false | ||
status_bar_style UIStatusBarStyleDefault | ||
else | ||
status_bar_hidden false | ||
global_style = NSBundle.mainBundle.objectForInfoDictionaryKey("UIStatusBarStyle") | ||
status_bar_style global_style ? Object.const_get(global_style) : UIStatusBarStyleDefault | ||
end | ||
end | ||
|
||
def add_nav_bar_buttons | ||
set_nav_bar_button(self.class.get_nav_bar_button[:side], self.class.get_nav_bar_button) if self.class.get_nav_bar_button | ||
end | ||
|
||
def status_bar_hidden(hidden) | ||
UIApplication.sharedApplication.setStatusBarHidden(hidden, withAnimation:self.class.status_bar_animation) | ||
end | ||
|
||
def status_bar_style(style) | ||
UIApplication.sharedApplication.setStatusBarStyle(style) | ||
end | ||
|
||
def parent_screen=(parent) | ||
@parent_screen = WeakRef.new(parent) | ||
end | ||
|
@@ -176,10 +137,64 @@ def frame | |
return self.view_or_self.frame | ||
end | ||
|
||
def add_child_screen(screen) | ||
screen = screen.new if screen.respond_to?(:new) | ||
addChildViewController(screen) | ||
screen.parent_screen = WeakRef.new(self) | ||
screen.didMoveToParentViewController(self) # Required | ||
screen | ||
end | ||
|
||
def remove_child_screen(screen) | ||
screen.parent_screen = nil | ||
screen.willMoveToParentViewController(nil) # Required | ||
screen.removeFromParentViewController | ||
screen | ||
end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This section is the main addition. |
||
|
||
private | ||
|
||
def resolve_title | ||
case self.class.title_type | ||
when :text then self.title = self.class.title | ||
when :view then self.navigationItem.titleView = self.class.title | ||
when :image then self.navigationItem.titleView = UIImageView.alloc.initWithImage(self.class.title) | ||
else | ||
PM.logger.warn("title expects string, UIView, or UIImage, but #{self.class.title.class.to_s} given.") | ||
end | ||
end | ||
|
||
def resolve_status_bar | ||
case self.class.status_bar_type | ||
when :none | ||
status_bar_hidden true | ||
when :light | ||
status_bar_hidden false | ||
status_bar_style UIStatusBarStyleLightContent | ||
when :dark | ||
status_bar_hidden false | ||
status_bar_style UIStatusBarStyleDefault | ||
else | ||
status_bar_hidden false | ||
global_style = NSBundle.mainBundle.objectForInfoDictionaryKey("UIStatusBarStyle") | ||
status_bar_style global_style ? Object.const_get(global_style) : UIStatusBarStyleDefault | ||
end | ||
end | ||
|
||
def add_nav_bar_buttons | ||
set_nav_bar_button(self.class.get_nav_bar_button[:side], self.class.get_nav_bar_button) if self.class.get_nav_bar_button | ||
end | ||
|
||
def status_bar_hidden(hidden) | ||
UIApplication.sharedApplication.setStatusBarHidden(hidden, withAnimation:self.class.status_bar_animation) | ||
end | ||
|
||
def status_bar_style(style) | ||
UIApplication.sharedApplication.setStatusBarStyle(style) | ||
end | ||
|
||
def apply_properties(args) | ||
reserved_args = [ :nav_bar, :hide_nav_bar, :hide_tab_bar, :animated, :close_all, :in_tab, :in_detail, :in_master, :to_screen ] | ||
reserved_args = [ :nav_bar, :hide_nav_bar, :hide_tab_bar, :animated, :close_all, :in_tab, :in_detail, :in_master, :to_screen, :toolbar ] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added |
||
set_attributes self, args.dup.delete_if { |k,v| reserved_args.include?(k) } | ||
end | ||
|
||
|
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made these methods private, like they should have been. No other changes, just moved them to the private method section.