nnhubbard / ZSSRichTextEditor

A beautiful rich text WYSIWYG editor for iOS with a syntax highlighted source view
MIT License
3.78k stars 584 forks source link

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

Open MHX792 opened 4 years ago

MHX792 commented 4 years ago

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

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

oangkin commented 4 years ago
@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
Mehul18292 commented 4 years ago

@oangkin : Where to write this code?

michafaw commented 4 years ago

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

comiclandapp commented 4 years ago

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

oangkin commented 4 years ago

@oangkin : Where to write this code?

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

oangkin commented 4 years ago

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

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

oangkin commented 4 years ago

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

你说的是对的

michafaw commented 4 years ago

这个是私有类,我的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 👍)