Custom buttons in XIB used as Custom UITableViewCell don't respond to taps (ios7)

前端 未结 5 764
野性不改
野性不改 2021-02-05 11:28

So here I am upgrading a working ios6 app to ios7, and now I can\'t receive taps or other actions on custom buttons (or other subviews) inside my tableviewcells.

Edit:

5条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-05 12:32

    I had a similar problem. I had dragged a UIView into the xib to use as my UITableViewCell. Even though I changed the classname to a subclass of a UITableViewCell in Interface Builder, the events on my buttons still didn't fire. Since it was originally a UIView, IB never knew about contentView and didn't add my controls to it.

    Dragging a "real" UITableViewCell into the xib, changing its class to the one I wanted, and then rewiring up the IBOutlets fixed everything. Didn't need to mess with delaysContentTouches or other properties either.

    Moral of the story: drag the right thing onto your xibs.

提交回复
热议问题