Use UITableViewCell as Button

后端 未结 1 1272
半阙折子戏
半阙折子戏 2021-01-22 15:51

I read some similar questions about this on Stack Overflow, but none of them had a satisfying answer.

What I am trying to achieve is a \"Facebook Sign In Button\" from t

相关标签:
1条回答
  • 2021-01-22 16:21

    Thats a reasonable way to go.

    A similar solution using indexpaths would be:

    Create an outlet for the Table View Cell from IB.

    @property (strong, nonatomic) IBOutlet UITableViewCell *loginButtonCell;
    

    Then implement the didSelectRowAtIndexPath: method.

    - (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath       *)indexPath
    {
        if ([indexPath isEqual:[tableView indexPathForCell:self.loginButtonCell]])
        {
            // This will get called when you cell button is tapped
        }
    }
    

    You can then re-order and without having to modify your code

    0 讨论(0)
提交回复
热议问题