Disable content bouncing scroll

前端 未结 10 1916
我寻月下人不归
我寻月下人不归 2021-02-09 06:25

In my hybrid app there\'s a possibility to drag the screen to refresh the list. In Android this works fine, but on iOS when I\'m dragging

相关标签:
10条回答
  • 2021-02-09 06:48

    Below solution worked for me : Tested only ionic 3.9 version

    Run command,

    1. ionic cordova platform add ios && ionic cordova prepare ios
    2. Then find CDVWKWebViewEngine.m, inside /platforms/ios//Plugins/cordova-plugin-ionic-webview/
    3. Put this line of code at the bottom of the lines and save it.

    @implementation UIScrollView (NoBounce)
    - (void)didMoveToWindow {
       [super didMoveToWindow];
       self.bounces = NO;
    }
    @end

    0 讨论(0)
  • 2021-02-09 07:01

    For Ionic 4, use:

    <ion-content [scrollY]="false">...</ion-content>
    
    0 讨论(0)
  • 2021-02-09 07:01

    on ionic 4 <ion-content no-bounce has-bouncing="false" forceOverscroll="false">. If this fail force to remove bounce with.

    To remove and force the not bounce in the component ion-content on ios, create the file DisableBounce.m With the following content.

    #import <Foundation/Foundation.h>
    #import <UIKit/UIKit.h>
    
    @implementation UIScrollView (NoBounce)
    - (void)didMoveToWindow {
        [super didMoveToWindow];
        self.bounces = NO;
    }
    @end
    

    and to save on platforms/ios/CordovaLib/Classes/Private/Plugins/CDVUIWebViewEngine. this disable all efect bounce in you app.

    0 讨论(0)
  • 2021-02-09 07:02

    I'm upgrading from Ionic 3 to Ionic 5 and found this post. But then just found the solution in documentation.
    I'm using Ionic 5 (not sure if Ionic 4 works too). Just add slot="fixed" to element inside ion-conent:

    <ion-content
      [scrollEvents]="true"
      (ionScrollStart)="logScrollStart()"
      (ionScroll)="logScrolling($event)"
      (ionScrollEnd)="logScrollEnd()">
        <h1>Main Content</h1>
    
        <div slot="fixed">
          <h1>Fixed Content</h1>
        </div>
    </ion-content>
    

    It works perfect in iOS.
    Source: https://ionicframework.com/docs/api/content

    0 讨论(0)
提交回复
热议问题