简体   繁体   中英

UIButton Not responding in custom UITableViewCell

When I select a button within a custom UITableViewCell, it does not respond to my touchevent.

用于创建自定义UITableViewCell的代码

Code that creates the custom UITableViewCell. I have done a lot of research for a solution and I try to bring the button to the front of the contentview.

笔尖视图

Here is how it looks in IB. Also, the tableview that host the custom UITableViewCell has userinteraction enabled along with the button and contentview. Update! The button is clickable if its within the top 44 points aka the equivalent height of a normal UITableViewCell. However, WHen I click it I get this error. I don't understand why it is only enabled for userinteraction within the first 44 points of its height. 在此处输入图片说明

Just try

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{


    return THE_ACTUAL_HEIGHT_OF_CELL_THAT_IS_GREATER_THAN_DEFAULT_44;

}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM