[英]How to check if a UIButtons title is equal to a specific string?
我正在嘗試有一個可以單擊的按鈕,如果標題是該字符串,它將執行 x ,否則不會。
if button.setTitle("Message", for: .normal) == true {
} else {
}
您可以使用currentTitle
屬性來檢查您想要的值。
setTitle
方法應該用於設置/更新標題值,而不是獲取它。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.