1
創建我的第一張世界風格tvOS應用程序,並不能得到我的第一個按鈕,工作...tvOS按鈕不能集中
不管是什麼我不能得到這個按鈕被聚焦。我已經用相同的結果在swift中嘗試過相同的東西。
- (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;
}
該解決方案並沒有爲我工作,你有沒有嘗試iOS11相同的代碼? – mgyky