mirror of
https://github.com/zhigang1992/RubyMotion.git
synced 2026-06-16 05:17:24 +08:00
Merge branch 'ft_storyboard_support' of https://github.com/marcisme/RubyMotion into marcisme-ft_storyboard_support
This commit is contained in:
@@ -169,6 +169,12 @@ module Bacon
|
||||
# * :tab => true
|
||||
def tests(controller_class, options = {})
|
||||
@controller_class = controller_class
|
||||
@options = {
|
||||
# name of storyboard file in resources directory
|
||||
:storyboard_name => 'MainStoryboard',
|
||||
# id of controller as assigned in Xcode
|
||||
:id => nil
|
||||
}.merge(options)
|
||||
extend Bacon::Functional::API
|
||||
extend Bacon::Functional::ContextExt
|
||||
end
|
||||
@@ -213,7 +219,15 @@ module Bacon
|
||||
attr_accessor :controller
|
||||
|
||||
def controller
|
||||
@controller ||= @controller_class.alloc.init
|
||||
@controller ||= if @options[:id]
|
||||
storyboard.instantiateViewControllerWithIdentifier(@options[:id])
|
||||
else
|
||||
@controller_class.alloc.init
|
||||
end
|
||||
end
|
||||
|
||||
def storyboard
|
||||
@storyboard ||= UIStoryboard.storyboardWithName(@options[:storyboard_name], bundle:nil)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user