tableViewcell button點擊 獲取cell的indexpath 並刷新當前cell

獲取indexpath:

-(void)chosedIntergetAction:(UIButton *)button event:(UIEvent *)event{

    UITouch *touch = [[event allTouches] anyObject];

    CGPoint point = [touch locationInView:self.tableView];

    NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:point];

    self.indexPath = indexPath;

    NSLog(@"section----%li,----row---%li",(long)indexPath.section,(long)indexPath.row);}


刷新點擊cell:

NSArray <NSIndexPath *> *indexPathArray = @[self.indexPath];

        [self.tableView reloadRowsAtIndexPaths:indexPathArray withRowAnimation:UITableViewRowAnimationAutomatic];


發佈了72 篇原創文章 · 獲贊 10 · 訪問量 10萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章