ios - TableView - 选择单元格时的操作

标签 ios uitableview

我有一些执行 segue 的单元格,但我想要一个单元格来注销当前用户。如何将此操作设置为单个单元格?

谢谢,蒂姆。

最佳答案

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    // User selected a row, so check if it's the logout row or not
    if (indexPath.row == logoutRowIndex) {
        // Logout
        [self logout];
    } else {
        // Perform segue
        [self performSegueWithIdentifier:@"segueIdentifier"];
    }
}

关于ios - TableView - 选择单元格时的操作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28180442/

相关文章:

ios - 如何将 UIImageView 放在 tableView 的中心

iphone - 动态添加 UITableViewCell 和 UITextField

iphone - 无法在 didSelectRowAtIndexPath 中隐藏自定义复选标记

iphone - UITableView 的委托(delegate)方法没有响应

ios - 当我需要自定义音频效果时是否需要处理音频单元,或者我可以依赖音频队列服务吗?

iphone - 不让 UIButton 拖到 Circle 外

ios - 在 firestore 中添加新 key 时应用程序崩溃

ios - 查看 NSDictionary 键是否在另一个 NSArray 中

c# - Xamarin : UISearchController is not becoming first responder and editing is not getting started while adding it to Navigation Bar

ios - UICollectionViewDiffableDataSource 正在替换数据而不是更新