UIView
にボタンがあり、ボタンが表示されているときにボタンにフォーカスを設定する必要がありますが、ボタンが表示されない理由はわかりませんビューが追加されたときにフォーカスします。tvOS:ボタンにフォーカスを強制する
- (void)didUpdateFocusInContext:(UIFocusUpdateContext *)context withAnimationCoordinator: (UIFocusAnimationCoordinator *)coordinator {
if (context.nextFocusedView == backButton) {
[UIView animateWithDuration:1 delay:0 usingSpringWithDamping:.40 initialSpringVelocity:.60 options:UIViewAnimationOptionAllowUserInteraction animations:^ {
context.nextFocusedView.transform = CGAffineTransformMakeScale(1.5, 1.5);
context.nextFocusedView.layer.shadowOffset = CGSizeMake(0, 10);
context.nextFocusedView.layer.shadowOpacity = 1;
context.nextFocusedView.layer.shadowRadius = 15;
context.nextFocusedView.layer.shadowColor = [UIColor redColor].CGColor;
context.nextFocusedView.layer.shadowOpacity = 1;
} completion:nil];
}
}
私も試した他のプロパティ:
- (void)openView {
[backButton preferredFocusedView];
[backButton canBecomeFocused];
[backButton setNeedsFocusUpdate];
[self.view addSubView:customView];
}
- (UIView *)preferredFocusedView {
return [backButton preferredFocusedView];
}
が、これらが働いたのどれも!
あなたの質問はiOSまたはXcodeではなくtvOSについてです。質問には関連するタグのみを使用してください。 – rmaddy
@rmaddy iOSとXcodeタグにはもっと多くのチャンスがあります! 200のタグしか持たないtvOSよりも私の質問を編集しないでください –
あなたはより多くの意見を得るために質問にタグを付けません。適切な知識を持つ人々があなたの質問を参照するように質問にタグを付けます。あなたの質問はiOSまたはXcodeに関連していません。間違ったタグを使用した点は何ですか?確かにあなたがより多くの意見を得るかもしれないが、それらの余分な意見は、おそらく必要な知識を持っていない人々からのものです。ロジックによって、JavaタグとAndroidタグも追加する必要があります。それはあまりにも多くのビューを与えるでしょう。 – rmaddy