我的UIButton"启用"成员不存在,为什么?

时间:2016-01-09 23:44:17

标签: ios swift uibutton

我试图让我的按钮被禁用,为什么会发生文本编辑,所以我使用button.enabled = false,但这在某种程度上是行不通的。 这是导致我麻烦的一点。

Public Sub UpdateClient(Client_ID As Integer, _ClientName As String, _Company_Add As String, _Email_Add As String,
                    _Tin_No As String, _Contact_Person As String, _Mobile_No As String, _Telephone_No As String,
                    _Remarks As String, _User As String)

    Try
        Dim strInsert As String = "UPDATE CLIENTS SET (ClientID = '" & Client_ID & "', ClientName = '" & _ClientName & "', Company_Add = '" & _Company_Add & "', Email_Add = '" & _Email_Add & "', Tin_No = '" & _Tin_No & "', Contact_Person = '" & _Contact_Person & "', Mobile_No = '" & _Mobile_No & "', Telephone_No = '" & _Telephone_No & "', Remarks = '" & _Remarks & "', User_ = '" & _User & "') WHERE (ClientID = '" & Client_ID & "') "

        SQLCon.Open()
        SqlCmd = New SqlCommand(strInsert, SQLCon)
        SqlCmd.ExecuteNonQuery()

        SQLCon.Close()
    Catch ex As Exception
        MsgBox(ex.Message)

    End Try
End Sub

并且错误是"类型'(UIButton)的值 - > ()'没有会员'已启用'"

我尝试过使用saveButton.userInteractionEnabled

那么问题是什么

1 个答案:

答案 0 :(得分:0)

如错误所示,saveButton是一个函数。该函数的参数为​​UIButton,但函数本身不是UIButton类型,它的类型为(UIButton) -> ()

saveButton需要是变量才能使代码正常工作。我假设saveButton是您的某个按钮所连接的IBAction。找到该按钮,为其创建IBOutlet,然后在textFieldDidBeginEditing中使用该按钮。