NSMutableDictionary with UIButton* as keys - iPhone development

前端 未结 4 1655
栀梦
栀梦 2021-02-20 12:38

I\'m new to iPhone development and I have a question that may have a very simple answer. I am trying to add buttons to a view and these buttons are associated with a custom clas

4条回答
  •  庸人自扰
    2021-02-20 13:05

    From Apple docs:

    The key is copied (using copyWithZone:; keys must conform to the NSCopying protocol).

    UIButton does not conform to the NSCopying protocol and so you cannot use it as a key in NSDictionary

提交回复
热议问题