UIBarButtonItem initWithCustom view selector not working

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?

Answers


For buttons why you are giving 'UIControlEventValueChanged' it should be UIControlEventTouchUpInside in addTarget method


Need Your Help

RequestHandler variables with threadsafe

google-app-engine

If I have a RequestHandler class, that has a variable (self.var below) that is initialized during a request. Can that variable be overwritten in a concurrent environment (threadsafe=true)? E.g.

Turning list of atoms into a single list using recursion

list recursion lisp scheme

I'm looking for an answer that turns a list of atoms into a single list recursively.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.