真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

怎么在iOS中利用UITableView實現(xiàn)一個左滑刪除復(fù)制即用功能

今天就跟大家聊聊有關(guān)怎么在iOS中利用UITableView實現(xiàn)一個左滑刪除復(fù)制即用功能,可能很多人都不太了解,為了讓大家更加了解,小編給大家總結(jié)了以下內(nèi)容,希望大家根據(jù)這篇文章可以有所收獲。

創(chuàng)新互聯(lián)建站專注于企業(yè)營銷型網(wǎng)站建設(shè)、網(wǎng)站重做改版、臨湘網(wǎng)站定制設(shè)計、自適應(yīng)品牌網(wǎng)站建設(shè)、H5網(wǎng)站設(shè)計、購物商城網(wǎng)站建設(shè)、集團公司官網(wǎng)建設(shè)、成都外貿(mào)網(wǎng)站制作、高端網(wǎng)站制作、響應(yīng)式網(wǎng)頁設(shè)計等建站業(yè)務(wù),價格優(yōu)惠性價比高,為臨湘等各大城市提供網(wǎng)站開發(fā)制作服務(wù)。

//設(shè)Cell可編輯
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
  return YES;
}
//設(shè)置刪除按鈕
-(UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
{
  return UITableViewCellEditingStyleDelete;
}
//進入編輯(刪除)模式
-(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{  
  //出現(xiàn)alterView隱藏刪除按鈕
  [tableView setEditing:NO animated:YES];
  if (editingStyle == UITableViewCellEditingStyleDelete) {
    UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"提示" message:@"你確定刪除該消息?" preferredStyle:UIAlertControllerStyleAlert];
    [alertController addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil]];
    [alertController addAction:[UIAlertAction actionWithTitle:@"確定" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
      //需要先刪除數(shù)據(jù)源中對應(yīng)數(shù)據(jù),不然執(zhí)行下一步會崩潰
      [reconnaissanceListArr removeObjectAtIndex:indexPath.row];
      [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
    }]];
    [self presentViewController:alertController animated:YES completion:nil];
  }
}
//修改編輯按鈕文字
-(NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath
{
  return @"刪除";
}
//設(shè)置進入編輯狀態(tài)時,Cell不會縮進
- (BOOL)tableView: (UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath
{
  return NO;
}

看完上述內(nèi)容,你們對怎么在iOS中利用UITableView實現(xiàn)一個左滑刪除復(fù)制即用功能有進一步的了解嗎?如果還想了解更多知識或者相關(guān)內(nèi)容,請關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝大家的支持。


網(wǎng)站欄目:怎么在iOS中利用UITableView實現(xiàn)一個左滑刪除復(fù)制即用功能
網(wǎng)址分享:http://weahome.cn/article/joocie.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部