I have a (pretty) simple setup as follows; It is a UIViewController (I will call this the Parent View Controller) with 4 container views and the corresponding child viewcontrollers.
-------------------------------
CV1 | CV 2 | CV3
-------------------------------
CONTAINER VIEW 4
CV 2 will get focus automatically by overriding the necessary methods when the parent view controller loads. It works.
CV1 does not contain any focusable views.
When container view 4 contains only a few items (it is a uicollectionview) swiping up on the remote will just show the tabbar (in which the parent view controller is added to.)
I have tried using the approach with subclassing UILabel and override the isfocusable() method to always return true but with no luck. The method is never called and so I guess that the entire CV1 is not part at all in the focus guide chain.
What is the best approach here? Should I implement the CV1 differently. I have seen this in some forum threads but it seems overkill.
Why does not overriding the isfocusable()-method in a subclass of uilabel to always return true work?
Can i add a focusguide to the entire CV1 somehow? And should I do that? In that case, I could just get the parent view controller, find the correct child viewcontroller and return this view controllers preferred view. But will it work? And I really dont want to do it. 🙂
kind regards from a snowy Sweden
Anders Ericsson
Can you provide more details about the behavior that you want? Since you say that CV1 has no focusable views, does that mean when swiping up from CV4 you always want focus to go to the contents of CV2?
Generally speaking, UIFocusGuide is the tool to use in situations like this. The parent view controller can configure UIFocusGuides to redirect focus to wherever your app logic determines it needs to go.