didSelectRowAtIndexPath event not triggered when select row programaticaly

from http://stackoverflow.com/questions/8705806/didselectrowatindexpath-event-not-triggered-when-select-row-programaticaly

 

t is working as documented:

Calling this method does not cause the delegate to receive a tableView:willSelectRowAtIndexPath: or tableView:didSelectRowAtIndexPath: message, nor will it send UITableViewSelectionDidChangeNotification notifications to observers.

Call it yourself after selecting your cell:

 

NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];

[self tableView:self.mainTable willSelectRowAtIndexPath:indexPath];

[self.mainTable selectRowAtIndexPath:indexPath animated:NO scrollPosition:UITableViewScrollPositionNone];

[self tableView:self.mainTable didSelectRowAtIndexPath:indexPath];

arrow
arrow
    全站熱搜

    zer931 發表在 痞客邦 留言(0) 人氣()