Ето моят много основен код. Той показва пет клетки в UICollectionView (всяка клетка с прост бутон в нея). Всички бутони сочат към единичния метод IBAction. Всичко това е настроено в Main.storyboard.
Въпреки това не мога да накарам tvOS да фокусира бутоните. Някаква идея защо?
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
return 5;
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"MyCell" forIndexPath:indexPath];
return cell;
}
- (IBAction)buttonAction
{
// do stuff
}
@end