jsqmessageviewcontroller ios11 toolbar

前端 未结 8 1297
故里飘歌
故里飘歌 2020-12-16 05:01

I have tried the swift example of JSQMessageViewController inside iOS 11 simulator. Here is the result:screenshot

I have tried using safe area margin an

8条回答
  •  青春惊慌失措
    2020-12-16 05:27

    Check this response:

    Which state:

    • Create an interface of JSQMessagesInputToolbar class, and
    • Override didMoveToWindow method to add this code:

      - (void)didMoveToWindow {
          [super didMoveToWindow];
          NSLog(@"didMoveToWindow");
          if (@available(iOS 11.0, *)) {
      
              UILayoutGuide * _Nonnull safeArea = self.window.safeAreaLayoutGuide;
              if (safeArea) {
                  NSLayoutYAxisAnchor * _Nonnull bottomAnchor = safeArea.bottomAnchor;
                  [[self bottomAnchor] constraintLessThanOrEqualToSystemSpacingBelowAnchor:bottomAnchor multiplier:1.0].active = YES;
              }
          }
      }
      

    Note: Creating interface is preferred over changing the class. Because if you used cocoa pods then each time you updated pods your changes will be overwritten.

    I have checked it with iPhone XR (Simulator) and iPhone 7 (Device) it works fine.

提交回复
热议问题