Friday, 27 September 2013

Button event touch not firing method from selector in IOS 7?

Button event touch not firing method from selector in IOS 7?

I have a strange behavior for a button in ios 7, not detecting touches but
in ios 6 works fine. The button it's loaded from a custom xib in which I
set an outlet for the button. The view with button it's initialized into
controller in which I set for button an action programmatic, after this
view it's added to a table like a subview. The code which I used:
viewWithButton = [[CustomView alloc] initWithFrame:CGRectMake(0, 64,
self.tableView.bounds.size.width, 44)];
[self.tableView addSubview:viewWithButton];
[viewWithButton.btn addTarget:self action:@selector(test)
forControlEvents:UIControlEventTouchUpInside];
And in custom view I have:
@property (nonatomic) IBOutlet UIButton *btn;
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self)
{
[[NSBundle mainBundle] loadNibNamed:@"viewWithButton" owner:self
options:nil];
self.view.frame = frame;
[self addSubview:self.view];
}
return self;}
The custom view it's displayed in tableview but I can't interact nohow
with button and this just in ios 7, in ios 6 works great and method(test)
it's called.
Any thoughts? (sorry for misspellings).
Thanks in advance for any help.

No comments:

Post a Comment