Swift UISlider that gets its values from an array of numbers -
i'm newbie swift , believe me i've searched , searched answer already. want create uisliders values array of numbers in swift. camera app example array should obvious.
@ibaction func isovaluechanged(sender: uislider) { let isoarray = ["24", "32", "50","64","80","100","125","160","200","250","320","400","500","640","720","800","1000","1250","1600","1800"] // available iphone 6s iso settings believe let currentvalue = // need? isotext.text = "\(currentvalue)" }
even harder representing shutter speeds 1/1000 - 32! see out there not easy 1 because there no mathematical representation calc array. possible?
i'm not quite sure understand want i'm guessing right.
// global variable or (accessible multiple functions) let isoarray = ["24", "32", "50","64","80","100","125","160","200","250","320","400","500","640","720","800","1000","1250","1600","1800"] // available iphone 6s iso settings believe func functionthatcreatestheslideryo(...) { slider.minimumvalue = 0 slider.maximumvalue = isoarray.count slider.continuous = false } @ibaction func isovaluechanged(sender: uislider) { // instead of int(val) may want round(val) better ui let currentvalue = isoarray[int(sender.value)] isotext.text = "\(currentvalue)" }
Comments
Post a Comment