How you have add button on cell
i am putting one sample
in
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
...
UIButton *btnDetail = [UIButton buttonWithType:UIButtonTypeRoundedRect] ;
[btnDetail setFrame:CGRectMake(225.0f, 15.0f, 65.0f, 20.0f)] ;
//btnDetail.backgroundColor = [UIColor grayColor];
[btnDetail setTitle:@"Detail" forState:UIControlStateNormal];
[btnDetail setTitleColor: [UIColor redColor] forState: UIControlStateNormal];
[btnDetail.titleLabel setFont:[UIFont fontWithName:@"Verdana-Bold" size:12]];
[btnDetail setBackgroundColor:[UIColor clearColor]];
[btnDetail sizeThatFits:btnDetail.frame.size];
[cell addSubview:btnDetail];
[btnDetail addTarget:self
action:@selector(function1:)
forControlEvents:UIControlEventTouchUpInside];
[btnDetail setImage:[UIImage imageNamed:@"btn-detail.png"] forState:UIControlStateNormal];
if you have written
[btnDetail addTarget:self
action:@selector(function1:)
forControlEvents:UIControlEventTouchUpInside];
your button should able to capture touch event and function1 should be called... on it's touch event...