スライドを再生しているときに進む、戻るボタンを押せないように設定したいのですが、押せないようにする方法がわかりません。enabledを使えばいいというようなwebページも見ましたが、使い方が分かりません。どうすれば良いのでしょうか?
swift
1 func imageDisplay(){ 2 3 photosImage = UIImage(named : images[countnumber]) 4 imageView.image = photosImage 5 6 7 } 8 9 //進むボタン 10 @IBAction func nextbuttontapaction(sender: AnyObject) { 11 nextpage() 12 } 13 14 //戻るボタン 15 @IBAction func backbuttontapaction(sender: AnyObject) { 16 if countnumber != 0{ 17 countnumber-- 18 }else if countnumber == 0{ 19 countnumber = images.count-1 20 } 21 imageDisplay() 22 } 23 24 //次のスライドへ 25 func nextpage(){ 26 // if countnumber < images.count-1{ 27 // countnumber++ 28 // }else if countnumber == images.count-1{ 29 // } 30 if countnumber < images.count-1{ 31 countnumber++ 32 }else if countnumber == images.count-1{ 33 countnumber = 0 34 } 35 imageDisplay() 36 } 37 38 //タイマー 39 func onUpdate(){ 40 timer = NSTimer.scheduledTimerWithTimeInterval(2.0, target:self,selector:("nextpage"),userInfo:nil,repeats:true) 41 42 } 43 //スライドの再生、停止ボタン 44 @IBAction func startandstopbutton(sender: AnyObject) { 45 if timer == nil { 46 // タイマーが動いていない 47 onUpdate() 48 } else { 49 // タイマーが動いていている 50 timer?.invalidate() 51 timer = nil 52 } 53 }
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/03/01 16:31