iOS 10 設置TableViewCell側滑時,當Cell上有按鈕的點擊事件,當Cell進入編輯狀態的時候取消按鈕的點擊事件


//定義編輯樣式

- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {

    JKDZMTGoodBaseCell * cell = (JKDZMTGoodBaseCell *)[tableView cellForRowAtIndexPath:indexPath];

    cell.coverImg.enabled = NO;

    return UITableViewCellEditingStyleDelete;

}

 

 

- (void)tableView:(UITableView *)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath{

    MyLog(@"開始進入編輯狀態");

    

    JKDZMTGoodBaseCell * cell = (JKDZMTGoodBaseCell *)[tableView cellForRowAtIndexPath:indexPath];

    cell.coverImg.enabled = NO;

    

}

- (void)tableView:(UITableView *)tableView didEndEditingRowAtIndexPath:(nullable NSIndexPath *)indexPath{

    MyLog(@"結束編輯狀態")

    JKDZMTGoodBaseCell * cell = (JKDZMTGoodBaseCell *)[tableView cellForRowAtIndexPath:indexPath];

    cell.coverImg.enabled = YES;

}

 

//修改編輯按鈕文字

- (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath {

    return @"刪除";

}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM