当按下“重做”按钮时,我很难找到一种方法来重新加载布局中标签中的变量。我正在使用ProMotion和Teacup布局。 “是”按钮有效。如何重新加载控制器并刷新布局?
class MoodController < UIViewController
stylesheet :mood
layout :mood do
@label = subview UILabel, :label
@subject_label = subview UILabel, :subject_label
@verb_label = subview UILabel, :verb_label
@object_label = subview UILabel, :object_label
@redo_button = subview(UIButton, :redo_button)
@yes_button = subview(UIButton, :yes_button)
end
def layoutDidLoad
self.title = "Normal Navbar"
@redo_button.addTarget( self, action:'redo',
forControlEvents:UIControlEventTouchUpInside)
@yes_button.addTarget( self, action:'yes',
forControlEvents:UIControlEventTouchUpInside)
end
def yes
@yes_pushed = ResultsController.new
self.navigationController << @yes_pushed
end
def redo
@redo_pushed = MoodController.new
self.navigationController << @redo_pushed
end
end