私のiPhoneアプリでカスタムヘッダービューがあります。それにはカスタムボタンがあります。 しかし、そのカスタムボタンアクションは火災ではなく、カスタムクラスにあるヘッダータップイベントが発生します。私に助けてください。ヘッダービューのボタンでアクションを発生させる方法。カスタムテーブルビューの問題
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
NSNumber *num=[NSNumber numberWithInt:section];
UIView * customView = [[[UIView alloc] initWithFrame:CGRectMake(0,0,320,50)]autorelease];
customView.tag = section;
[customView setUserInteractionEnabled:YES];
customView.backgroundColor = [UIColor blackColor];
UIButton *button=[UIButton buttonWithType:UIButtonTypeCustom];
button.frame=CGRectMake(260, 7, 25, 25);
button.tag=section;
[button addTarget:self action:@selector(expandCollapsing:) forControlEvents:UIControlEventTouchUpInside];
[button setImage:[UIImage imageNamed:@"add.png"] forState:UIControlEventTouchUpInside];
[button setSelected:YES];
}
あなたは、あなたのコードを投稿してくださいことはできますか? –
ちょっと、最近投稿したスニペットを置き換えてください。クリックの問題を解決します。カスタムビューやジェスチャーも使用する必要はありません。 – Kuldeep
コード内でビューを返す部分が欠落しているか、カスタムビューにボタンをサブビューとして追加しました。私はこれがちょうどあなたのコードからではなく、質問に欠けていると思いますか? – jrturton