1
我想在RubyMotion項目中混合運動佈局和茶杯。我創建了一個例子視圖助手來說明我的問題:混合運動佈局和茶杯
module Teacup::Layout
def example(name, options = {})
subview UIView, name do
subview UILabel, "#{name}_label".to_sym, text: options[:label]
auto do
horizontal "|-[#{name}_label]-|"
end
end
end
end
當我打電話example(:example), text: "Test"
一個layout
塊裏面,我的代碼拋出以下異常:
(main)> 2013-10-25 13:40:45.989 rui[55552:80b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unable to parse constraint format:
example_label is not a key in the views dictionary.
H:|-[example_label]-|
如果我忽略了運動佈局代碼並檢查意見,example_label
視圖是example
視圖的子項。這裏發生了什麼?
也許嘗試使用字符串而不是符號?我不是自動佈局專家。 –
不幸的是,這並沒有成功。 – LandonSchropp
我認爲這段代碼應該可以工作,明天我會玩吧! :-) – colinta