ios - Show array elements in textView (Swift) -
how can add elements array textview 1 second delay?
language- swift (still relatively new programming)
i think need
class viewcontroller: uiviewcontroller { @iboutlet weak var textview: uitextview! var array = ["string1", "string2", "string3"] var = 0 var str: string = "" var timer = nstimer() func testfunc() { str += "\(array[i])\n" textview.text = str if == count(array) - 1 { timer.invalidate() } += 1 } override func viewdidload() { super.viewdidload() timer = nstimer.scheduledtimerwithtimeinterval(1.0, target: self, selector: selector("testfunc"), userinfo: nil, repeats: true) } override func didreceivememorywarning() { super.didreceivememorywarning() // dispose of resources can recreated. } }
Comments
Post a Comment