ios - Custom UITableViewCell, button in cell not working -
i have uitableviewcontroller i'm working custom uitableviewcell. cell contains image, labels , buttons. working expected except of buttons. when pressing button, nothing happens. cell gets selected.
i made connection in ib button custom tweettableviewcell class.
@property (weak, nonatomic) iboutlet uibutton *cellfollowbutton; - (ibaction)followbuttontappedoncell:(id)sender;
i'm writing text console in followbuttontappedoncell action. when pressing button, nothing happens. seems me view consumes tap before arrives button. make more confusing... when add button in may uitableviewcontroller programatically this:
[cell.cellfollowbutton addtarget:self action:@selector(customactionpressed) forcontrolevents:uicontroleventtouchdown]; [cell addsubview:cell.cellfollowbutton];
...it works. read in other articles disabling "user interaction enabled" solved similar problems, doesn't in case. i'm sure many others must have run problem when using buttons in uitableviewcells. highly appreciated.
i'm using xcode 5 ios 7.
i recommend go through this link. has clear description of problem. however, i've tried extract needed info.
many types of events rely on responder chain event delivery. responder chain series of linked responder objects. starts first responder , ends application object. if first responder cannot handle event, forwards event next responder in responder chain.
a responder object object can respond , handle events. uiresponder class base class responder objects, , defines programmatic interface not event handling common responder behavior. instances of uiapplication, uiviewcontroller, , uiview classes responders, means views , key controller objects responders.
in case, when writing event methods in customtableviewcell class, methods not being called. because, tableviewcell not participating in responder chain.
next thing is, check whether "user interaction enabled " or not cell. can find under view section of "attribute inspector".
Comments
Post a Comment