2012-10-01 33 views
0

引用documentation可以通過多種方式更改UISlider的屬性。如何使用Rubymotion定製UISlider?

如何編輯Rubymotion中的滑塊以設置例如minimumValueImage

slider = UISlider.alloc.initWithFrame([[50, 50], [200, 40]]) 
# ??? 
+0

因爲我貼我的問題我寫了關於這個問題的整篇文章,請訪問:http://marcgg.com/2012/10/22/custom-slider-ios -rubymotion/ – marcgg

回答

1

mininumValueImage是UISlider的財產。所以,你可以將其設置是這樣的:

slider.minimumValueImage = UIImage.imageNamed("sliderMinValueImage") 
+0

能否詳細說明'UIImage'?例如,我應該存儲它們以及如何加載它們?非常感謝您的回答! – marcgg

+1

將圖像放入RubyMotion中應用程序的'resources'目錄中。上面顯示的代碼加載圖像。您還可以放入第二個圖像,名稱爲'sliderMinValueImage @ 2x',並且在視網膜顯示屏上運行時會自動加載。我建議您使用PNG格式,並且不必在PNG文件名末尾有'.png'。 – vacawama

+0

完美,非常感謝! – marcgg