ZSSRichTextEditor icon indicating copy to clipboard operation
ZSSRichTextEditor copied to clipboard

How to hide second toolbar below rich text toolbar? [Xcode 11]

Open MHX792 opened this issue 5 years ago • 8 comments

Manually added the source files. How to hide the second toolbar?

Simulator Screen Shot - iPhone 8 - 2019-12-02 at 23 02 20

MHX792 avatar Dec 02 '19 22:12 MHX792

@interface Test
@property (nonatomic, strong) UIWindow *textEffectsWindow;
@end

@implementation Test

- (UIWindow *)textEffectsWindow {
     __block UIWindow *keyboardWindow = nil;
     [UIApplication.sharedApplication.windows enumerateObjectsUsingBlock:^(__kindof UIWindow * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        if ([obj.class isEqual:NSClassFromString(@"UITextEffectsWindow").class]) {
            keyboardWindow = obj;
            *stop = YES;
          }
        }];
    return keyboardWindow;
}


- (void)hideTextEffectsWindow {
    self.textEffectsWindow.layer.opacity = 0;
}

- (void)keyboardWillShowOrHide:(NSNotification *)notification {
    if (keyboardEnd.origin.y < [[UIScreen mainScreen] bounds].size.height) {
       [self hideTextEffectsWindow];
    } else {
      
    }
}
@end

oangkin avatar Dec 23 '19 08:12 oangkin

@oangkin : Where to write this code?

Mehul18292 avatar Dec 24 '19 05:12 Mehul18292

Is UITextEffectsWindow a private class? If it is, wouldn't this solution be a potential problem during submission to the App Store?

michafaw avatar Dec 27 '19 21:12 michafaw

Seems to work in the editor view. Call [self hideTextEffectsWindow]; in - (void)keyboardWillShowOrHide:(NSNotification *)notification { just below if (keyboardRect.origin.y < screeenHeight) {.

comiclandapp avatar Dec 28 '19 00:12 comiclandapp

@oangkin : Where to write this code?

我更新了回复,在键盘出现的时候调用即可

oangkin avatar Dec 29 '19 13:12 oangkin

Is UITextEffectsWindow a private class? If it is, wouldn't this solution be a potential problem during submission to the App Store?

这个是私有类,我的app审核通过了,如果要实现这个功能目前没别的办法。

oangkin avatar Dec 29 '19 13:12 oangkin

Seems to work in the editor view. Call [self hideTextEffectsWindow]; in - (void)keyboardWillShowOrHide:(NSNotification *)notification { just below if (keyboardRect.origin.y < screeenHeight) {.

你说的是对的

oangkin avatar Dec 29 '19 13:12 oangkin

这个是私有类,我的app审核通过了,如果要实现这个功能目前没别的办法。

@oangkin Ok, but if I understand the way Apple reviews work, there is a chance that they will find private calls in any submission to the store. (including updates) So unfortunately this is not a useable solution for my team even if it is the only way. (Congrats on making it through 👍)

michafaw avatar Dec 30 '19 22:12 michafaw