'activity' 在此 RubyMotion 代码中的何处定义?
Where is 'activity' defined in this RubyMotion code?
在此代码中,使用了 'activity' 但从未定义。它首先在哪里定义?我很困惑...
https://github.com/HipByte/RubyMotionSamples/blob/master/android/Conference/app/about_fragment.rb#L4
AboutFragment
class继承自Android::App::Fragment
,所以最有可能的答案是activity
被定义为Android::App::Fragment
上的实例方法。
其工作原理的简化版本是:
module Android
module App
class Fragment
def activity
"Activity!"
end
end
end
end
class AboutFragment < Android::App::Fragment
def onCreateView
puts activity # Will print "Activity!"
end
end
在此代码中,使用了 'activity' 但从未定义。它首先在哪里定义?我很困惑...
https://github.com/HipByte/RubyMotionSamples/blob/master/android/Conference/app/about_fragment.rb#L4
AboutFragment
class继承自Android::App::Fragment
,所以最有可能的答案是activity
被定义为Android::App::Fragment
上的实例方法。
其工作原理的简化版本是:
module Android
module App
class Fragment
def activity
"Activity!"
end
end
end
end
class AboutFragment < Android::App::Fragment
def onCreateView
puts activity # Will print "Activity!"
end
end