Reputation: 6092
I have a right bar button item created using initWithCustom, which works okay on iOS7 and 7.1. But on iOS 8 the selector not working anymore. code:
UIButton *btnReload = [UIButton buttonWithType:UIButtonTypeCustom];
[btnReload setFrame:CGRectMake(0, 6, 80, 30)];
[btnReload setTitle:@"RELOAD" forState:UIControlStateNormal];
[btnReload setTitleColor:[UIColor greenColor] forState:UIControlStateNormal];
[btnReload.titleLabel setFont:[UIFont boldSystemFontOfSize:14.f];
[btnReload addTarget:self action:@selector(reloadView:) forControlEvents:UIControlEventValueChanged];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:btnReload];
It seems touches are getting lost somewhere. If I create a custom UIButton class which may work, but I can't find where I did wrong or iOS8 has changed something. Any help?
Upvotes: 0
Views: 268
Reputation: 563
For buttons why you are giving 'UIControlEventValueChanged' it should be UIControlEventTouchUpInside in addTarget method
Upvotes: 1