UITableViewCell no responde a la cadena de respuesta
Frecuentes
Visto 305 veces
1
I encountered a problem during the development, I have a UITableViewCell
, agrega un UIButton
(UIButton
was full of the Cell), I hope my UIButton
response my touchupinside
event, after processing is completed, the events send up again, until the Cell to response didSelectRowAtIndexPath
method.but now,didSelectRowAtIndexPath
didn't work? (note: I don't want to manually call didSelectRowAtIndexPath
method, I hope that through the responder chain to solve this problem)
1 Respuestas
1
If the button is smaller than the cell, it should work as expected: if you touch the button, the button handler fires, if you touch another area in the cell, didSelectRowAtIndexPath
incendios
If, however, the button covers the entire cell, this is a non-issue. You can call the same routine from the button handler as from the table view delegate.
- (void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[self doCellThingWithIndexPath:indexPath];
}
- (void)buttonAction:(UIButton*)sender {
// do whatever the button does, then
CGRect buttonFrame = [button convertRect:sender.bounds toView:self.tableView];
NSIndexPath *indexPath = [self.tableView
indexPathForRowAtPoint:buttonFrame.origin];
[self doCellThingWithIndexPath:indexPath];
}
respondido 27 nov., 13:09
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas ios objective-c uitableview uibutton or haz tu propia pregunta.
button action is working but did selectrow is not being called right? - amar