I'm trying to create a UIButton programmatically in iOS 14 (beta 3) in objective-C. This is what I've tried, but the UIAction handler is never called when I tap the button:
UIAction *tapAction = [UIAction actionWithHandler:^(UIAction* action){
NSLog(@"Never gets here");
}];
UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 100, 100) primaryAction:tapAction];
Any ideas?
I had the same issue. It looks like a bug to me. Try adding:
to init(style:reuseIdentifier:) if you are using a custom tableview cell. Please refer to https://developer.apple.com/forums/thread/661508?page=1#636261022 and @OOPer great answer.