すべての 'btn1' は同じメソッドを呼び出します。
PS: これはUITableView
ボタンが押された行を取得する方法を知りたいです。すべてのボタンでループを実行して、最後のボタンとは異なるボタンタグを設定しようとしました:
// Handle the buttons tag
int tagCount = 100;
// mainArray is the array of the tableView
for (int i = 0; i < [self.mainArray count]; i++) {
// I created a NSIndexPath to access the tableView cells
NSIndexPath *nowIndex = [NSIndexPath indexPathForRow:i inSection:0];
UITableViewCell *cell = (UITableViewCell *)[(UITableView *)self.view cellForRowAtIndexPath:nowIndex];
// I set the button tag as the 'int';
UIButton *shareButton = (UIButton *)[cell viewWithTag:100];
[shareButton setTag:tagCount];
tagCount++;
}
しかし、タグはまだ 100 です。
解決策はありますか?