テーブルを含むポップオーバービューがあり、セルをクリックしたときにデータを返したいのですが、方法がわかりません...
質問する
4731 次
2 に答える
0
テーブルビューが別のクラスにある場合、またはテーブルビューが同じクラスにある場合は、デリゲートを試すことができます.didSelectRowAtIndexPathを参照してください。
デリゲートを書く:
ポップオーバー テーブル クラスの .h ファイル:
@protocol PopOverSelectionDelegate;
@property (nonatomic,weak) id <PopOverSelectionDelegate> delegate;
@protocol PopOverSelectionDelegate
@optional
- (void)popOverItemSelected:(NSString *)selectedItem;
@end
.m ファイル内
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[self.delegate popOverItemSelected: [yourArray objectAtIndex:indexPath.row]];
}
于 2013-05-07T11:40:41.273 に答える