[tvOS] How to remove focus altogether

I have an app that has a single UITextField on screen. I also have other UI components being rendered via OpenGL. I have a focus engine that mimics the tvOS engine, which can move focus between the various items on screen, including the UITextField. The problem I have is that when I move focus away from the UITextField, it remains highlighted as if it still has focus.


This is because (I believe) UIKit is still managing focus and has no other UIKit widget to move focus to.


I thought that by using:


- (void) setFocused:(BOOL)focused {
    // Apple doesn't allow us to directly control focus (for good reasons in a full UIKit app), so we have to be a little tricky.
    // By changing userInteractionEnabled we can control whether UIKit allows an item to be focused or not.  So on a scene with
   // only one UIKit view, we can effectively move focus to the view by enabling it, and remove focus by disabling it.
    //
    self.textField.userInteractionEnabled = focused;
    self.textField.enabled = focused;

    [self.textField setNeedsFocusUpdate];
    [self.textField updateFocusIfNeeded];
}


the text field would become ineligible for focus and that it would lose it's focus highlighting. This certainly seems to work initially, however if I then set focused to YES via this code, UIKit highlights it and I can't find a way to remove that highlight when I move focus away.


The above method has been used for a UITableView in the past and it worked just fine (hence the comment), so I thought it would work for a UITextField as well.


Any suggestions would be most welcome.


Other things I have tried:

1. Having another, off screen UITextField that has the opposite userInteractionEnabled state. (yuck, but it didn't work)

2. Using

self.textfield.selected = focused;


[update #1]

3. I have also subclassed UITextField and added the following to the subclass:

- (BOOL) canBecomeFocused {
    return self.userInteractionEnabled;
}
- (UIView *)preferredFocusedView {
    if (self.userInteractionEnabled == YES) {
        return self;
    } else {
        return nil;
    }
}

What I note is that when textfield.userInteractionEnabled is first set to YES, canBecomeFocused() is called several times. If I then set textfield.userInteractionEnabled to NO, canBecomeFocused() is not called, and as a result, the focus engine doesn't de-focus the text field.