2016-10-17 12 views
6
@IBOutlet weak var catParentIdButton: UIButton! 

मेरे पास यह कोड है और अब मैं प्रोग्राम लेबल को प्रोग्राम लेबल लिखना चाहता हूं।
स्विफ्ट 3.0 में बटन के लेबल को लिखने के लिए वाक्यविन्यास क्या होगा?स्विफ्ट 3 में बटन लेबल कैसे सेट करें?

+2

'downloadButton.setTitle (" आपका शीर्षक ", के लिए: असामान्य)' – iDeveloper

उत्तर

13

विधि हस्ताक्षर स्विफ्ट 3.0 में बदल

func setTitle(_ title: String?, 
     for state: UIControlState) // Use this method to set the title for the button 

उदाहरण:

btn.setTitle(title: "Title", for: .normal) 

नोट एक btn नियंत्रण से डिफ़ॉल्ट स्थिति .normal को .Normal करने के लिए बदल गया है।

// previous 
public static var Normal: UIControlState { get } 

// Swift 3.0 
static var normal: UIControlState { get } 
संबंधित मुद्दे