Reputation: 3506
Creating my first yellow world style tvOS app and cannot get my first button to work...
No matter what I cannot get this button to be focused. I've tried the same thing in swift with the same result.
- (void)viewDidLoad {
[super viewDidLoad];
startSlideshowButton = [[UIButton alloc]initWithFrame:CGRectMake(100, 100, 300, 50)];
[startButton setTitle:@"Start" forState:UIControlStateNormal];
[startButton addTarget:self action:@selector(startPressed:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:startButton];
[self setNeedsFocusUpdate];
}
-(UIView*)preferredFocusedView{
return startButton;
}
Upvotes: 1
Views: 134
Reputation: 3506
Was using the wrong controlEvent
correct:
[startButton addTarget:self action:@selector(startPressed:) forControlEvents:UIControlEventPrimaryActionTriggered];
Upvotes: 2