I am making an application for tvOS. I have a view that contains a UIButton
and a custom UIView
that contains a couple other custom views. The simulator is only able to highlight the UIButton
and not the custom view.
According to the Building Apple TV Apps Docs:
If your custom view needs to be focusable, override canBecomeFocused to return YES (by default, it returns NO).
According to the canBecomeFocused Docs:
canBecomeFocused will return
YES if the view can become focused; NO otherwise.
However, attempting to assign YES to canBecomeFocused by doing this:
self.customView.canBecomeFocused = YES;
Gives this error:
No setter method 'setCanBecomeFocused:' for assignment to property
How do I accomplish this?
It looks like UIView
declares the function/property.
Have you tried overriding the function like so?
override func canBecomeFocused() -> Bool {
return true
}
- (BOOL)canBecomeFocused {
return YES;
}
I haven't tried this, but it may work for you.