2016-07-17 189 views
-4

你好我在這裏是新的,新的應用程序開發,但我建立一個多視圖的應用程序,我想添加一個按鈕,將進入下一個視圖,但用戶將不得不等待3在按鈕可用於點擊之前,每個視圖需要幾秒鐘的時間。Xcode延遲按鈕

回答

1

你可以延遲後顯示或使您的按鈕執行的方法,

[self performSelector:@selector(yourMethod) withObject:nil afterDelay:3.0]; 
+0

感謝信息JingJingTao – Jamskins

0

,如果你想延遲發生後按鈕自來水然後看看下面的代碼

let tapGesture = UITapGestureRecognizer(target: self, action: "tapAction") 
    tapGesture.numberOfTapsRequired = 1 
    Your_Button_name.addGestureRecognizer(tapGesture) 


    @IBAction func tapAction() 
    { 
     Your_Button_name.disable=true 
     //Delay function to enable your button 
     NSTimer.scheduledTimerWithTimeInterval(Your_time_value_delay, target: self, selector: Selector("enablefunc"), userInfo: nil, repeats: false) 

// DO SOMETHING WHICH YOU WANT TO DO..... 
    } 

    func enablefunc() 
    { 
     Your_Button_name.disable=false 
    } 

希望這有助於。您可以根據您的要求對其進行修改....

+0

感謝您的信息Jobins John – Jamskins