Method To Delete 2nd Label, Then First Label, Not Functioning Correctly

后端 未结 4 2049
心在旅途
心在旅途 2021-01-25 11:21

I know I am missing something obvious, but I just cannot see it. This method is meant to compare the text of a label to the text of a text box, and then delete the text. So if t

4条回答
  •  故里飘歌
    2021-01-25 11:35

    You should not use == or != for string comparison in Objective C. You need to use the isEqualToString or isEqual method.

    if (([self.lblFabric2.text isEqualToString:self.txtType.text]))
    

    When you use == or != you are comparing the pointers where the strings are stored.

提交回复
热议问题