Blue Highlighting / Focus Ring on Catalyst App

前端 未结 6 1641
夕颜
夕颜 2020-12-29 11:52

I\'m currently in the process of porting my iOS app to macOS using Project Catalyst.

All of my text fields, text views and table views have a blue outline when activ

6条回答
  •  再見小時候
    2020-12-29 11:57

    There is a private method _setFocusRingType: that appears to match the NSView API. I was able to use that to eliminate the focus ring, though this may not pass app review.

    Use this at your own risk:

    SEL selector = NSSelectorFromString(@"_setFocusRingType:");
    NSMethodSignature *signature = [self.textView methodSignatureForSelector:selector];
    NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
    [invocation setSelector:selector];
    NSUInteger arg = 1; // NSFocusRingTypeNone
    [invocation setArgument:&arg atIndex:2];
    [invocation invokeWithTarget:self.textView];
    

    Hopefully we get a real solution from Apple.

提交回复
热议问题