iOS PDFKit Disable vertical scroll bounceHow can I disable the UITableView selection?How to Check if element is visible after scrolling?Vertically align text to top within a UILabelScroll to the top of the page using JavaScript/jQuery?Check if a user has scrolled to the bottomHow to disable scrolling temporarily?Disabling vertical scrolling in UIScrollViewUIWebView delegate vertical scroll event to parent, if scrolled to top or bottomApple's PDFKit: Free draw with Ink annotationiOS PDFKit - width issue

Detention in 1997

Can we compute the area of a quadrilateral with one right angle when we only know the lengths of any three sides?

In 'Revenger,' what does 'cove' come from?

Examples of smooth manifolds admitting inbetween one and a continuum of complex structures

Running Low on Limestone

How can I deal with my CEO asking me to hire someone with a higher salary than me, a co-founder?

Determining Impedance With An Antenna Analyzer

Unlock My Phone! February 2018

Arrow those variables!

Should I tell management that I intend to leave due to bad software development practices?

How much of data wrangling is a data scientist's job?

How do I gain back my faith in my PhD degree?

How painful is tzara'at

What is a romance in Latin?

ssTTsSTtRrriinInnnnNNNIiinngg

How to tell a function to use the default argument values?

What historical events would have to change in order to make 19th century "steampunk" technology possible?

How do I handle a potential work/personal life conflict as the manager of one of my friends?

Does the Idaho Potato Commission associate potato skins with healthy eating?

Personal Teleportation: From Rags to Riches

Is it inappropriate for a student to attend their mentor's dissertation defense?

Different meanings of こわい

How badly should I try to prevent a user from XSSing themselves?

What does “the session was packed” mean in this context?



iOS PDFKit Disable vertical scroll bounce


How can I disable the UITableView selection?How to Check if element is visible after scrolling?Vertically align text to top within a UILabelScroll to the top of the page using JavaScript/jQuery?Check if a user has scrolled to the bottomHow to disable scrolling temporarily?Disabling vertical scrolling in UIScrollViewUIWebView delegate vertical scroll event to parent, if scrolled to top or bottomApple's PDFKit: Free draw with Ink annotationiOS PDFKit - width issue













2















How does one disable scroll bounce in a PDFView using PDFKit?



The view where the PDF is shown doesn't have a scroll bounce option.



Here's my code:



if let path = Bundle.main.path(forResource: pdfObject, ofType: "pdf") 
let url = URL(fileURLWithPath: path)
if let pdfDocument = PDFDocument(url: url)

pdfView.autoresizesSubviews = true
pdfView.autoresizingMask = [.flexibleWidth, .flexibleHeight,
.flexibleTopMargin, .flexibleLeftMargin]

pdfView.autoScales = true
pdfView.displaysPageBreaks = true
pdfView.displayDirection = .vertical
pdfView.displayMode = .singlePageContinuous
pdfView.document = pdfDocument

pdfView.maxScaleFactor = 4.0
pdfView.minScaleFactor = pdfView.scaleFactorForSizeToFit




Thanks in advance (for what is likely a ridiculously simple question!)










share|improve this question




























    2















    How does one disable scroll bounce in a PDFView using PDFKit?



    The view where the PDF is shown doesn't have a scroll bounce option.



    Here's my code:



    if let path = Bundle.main.path(forResource: pdfObject, ofType: "pdf") 
    let url = URL(fileURLWithPath: path)
    if let pdfDocument = PDFDocument(url: url)

    pdfView.autoresizesSubviews = true
    pdfView.autoresizingMask = [.flexibleWidth, .flexibleHeight,
    .flexibleTopMargin, .flexibleLeftMargin]

    pdfView.autoScales = true
    pdfView.displaysPageBreaks = true
    pdfView.displayDirection = .vertical
    pdfView.displayMode = .singlePageContinuous
    pdfView.document = pdfDocument

    pdfView.maxScaleFactor = 4.0
    pdfView.minScaleFactor = pdfView.scaleFactorForSizeToFit




    Thanks in advance (for what is likely a ridiculously simple question!)










    share|improve this question


























      2












      2








      2


      1






      How does one disable scroll bounce in a PDFView using PDFKit?



      The view where the PDF is shown doesn't have a scroll bounce option.



      Here's my code:



      if let path = Bundle.main.path(forResource: pdfObject, ofType: "pdf") 
      let url = URL(fileURLWithPath: path)
      if let pdfDocument = PDFDocument(url: url)

      pdfView.autoresizesSubviews = true
      pdfView.autoresizingMask = [.flexibleWidth, .flexibleHeight,
      .flexibleTopMargin, .flexibleLeftMargin]

      pdfView.autoScales = true
      pdfView.displaysPageBreaks = true
      pdfView.displayDirection = .vertical
      pdfView.displayMode = .singlePageContinuous
      pdfView.document = pdfDocument

      pdfView.maxScaleFactor = 4.0
      pdfView.minScaleFactor = pdfView.scaleFactorForSizeToFit




      Thanks in advance (for what is likely a ridiculously simple question!)










      share|improve this question
















      How does one disable scroll bounce in a PDFView using PDFKit?



      The view where the PDF is shown doesn't have a scroll bounce option.



      Here's my code:



      if let path = Bundle.main.path(forResource: pdfObject, ofType: "pdf") 
      let url = URL(fileURLWithPath: path)
      if let pdfDocument = PDFDocument(url: url)

      pdfView.autoresizesSubviews = true
      pdfView.autoresizingMask = [.flexibleWidth, .flexibleHeight,
      .flexibleTopMargin, .flexibleLeftMargin]

      pdfView.autoScales = true
      pdfView.displaysPageBreaks = true
      pdfView.displayDirection = .vertical
      pdfView.displayMode = .singlePageContinuous
      pdfView.document = pdfDocument

      pdfView.maxScaleFactor = 4.0
      pdfView.minScaleFactor = pdfView.scaleFactorForSizeToFit




      Thanks in advance (for what is likely a ridiculously simple question!)







      ios swift scroll uiscrollview pdfkit






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 21 at 21:08









      Paulo Mattos

      11.5k53855




      11.5k53855










      asked Mar 20 at 15:21









      Nicholas FarmerNicholas Farmer

      305319




      305319






















          1 Answer
          1






          active

          oldest

          votes


















          1














          Unfortunately, there isn't an exported API to set the PDFView desired bouncing behavior.



          Having said that, you can (safely) exploit a PDFView implementation detail to hack your way around it for now:



          extension PDFView 

          /// Disables the PDFView default bouncing behavior.
          func disableBouncing()
          for subview in subviews
          if let scrollView = subview as? UIScrollView
          scrollView.bounces = false
          return


          print("PDFView.disableBouncing: FAILED!")





          and then use it like this in your code:



          pdfView.disableBouncing()


          Caveat. Please keep in mind that such solution might break in future iOS releases. Nevertheless, rest assured your app won't crash as a result (you only won't be disabling the bouncing behavior at all).






          share|improve this answer

























          • Hi Paulo, thanks for the reply. Unfortunately this doesn't have any effect. However thanks for letting me know I'm not missing a 'bounce' behavior attribute. Might have to wait for an update on PDFKit form apple.

            – Nicholas Farmer
            Mar 22 at 13:22











          • @NicholasFarmer Hmm... I did a quick test here and was able to successfully disable the bouncing behavior on the PDFView. Will upload a short gist when I get a chance...

            – Paulo Mattos
            Mar 22 at 15:24












          • Hey @NicholasFarmer, run this code in a Swift Playground in Xcode (be sure the Live View is showing) and you will see that the vertical scroll bouncing is indeed disabled. Comment out the pdfView.disableBouncing() line to enable it back.

            – Paulo Mattos
            Mar 22 at 20:24







          • 1





            Hi Paulo, apologies for the late reply. I went back and re-tested and still didn't work...however after recent update and upgrade to swift 5 - this now works beautifully. Many thanks for your input. Your answer has been accepted and upvoted. Kind regards

            – Nicholas Farmer
            2 days ago











          • Hey @NicholasFarmer, glad to hear that ;) Good luck with your app!

            – Paulo Mattos
            2 days ago











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55264330%2fios-pdfkit-disable-vertical-scroll-bounce%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          Unfortunately, there isn't an exported API to set the PDFView desired bouncing behavior.



          Having said that, you can (safely) exploit a PDFView implementation detail to hack your way around it for now:



          extension PDFView 

          /// Disables the PDFView default bouncing behavior.
          func disableBouncing()
          for subview in subviews
          if let scrollView = subview as? UIScrollView
          scrollView.bounces = false
          return


          print("PDFView.disableBouncing: FAILED!")





          and then use it like this in your code:



          pdfView.disableBouncing()


          Caveat. Please keep in mind that such solution might break in future iOS releases. Nevertheless, rest assured your app won't crash as a result (you only won't be disabling the bouncing behavior at all).






          share|improve this answer

























          • Hi Paulo, thanks for the reply. Unfortunately this doesn't have any effect. However thanks for letting me know I'm not missing a 'bounce' behavior attribute. Might have to wait for an update on PDFKit form apple.

            – Nicholas Farmer
            Mar 22 at 13:22











          • @NicholasFarmer Hmm... I did a quick test here and was able to successfully disable the bouncing behavior on the PDFView. Will upload a short gist when I get a chance...

            – Paulo Mattos
            Mar 22 at 15:24












          • Hey @NicholasFarmer, run this code in a Swift Playground in Xcode (be sure the Live View is showing) and you will see that the vertical scroll bouncing is indeed disabled. Comment out the pdfView.disableBouncing() line to enable it back.

            – Paulo Mattos
            Mar 22 at 20:24







          • 1





            Hi Paulo, apologies for the late reply. I went back and re-tested and still didn't work...however after recent update and upgrade to swift 5 - this now works beautifully. Many thanks for your input. Your answer has been accepted and upvoted. Kind regards

            – Nicholas Farmer
            2 days ago











          • Hey @NicholasFarmer, glad to hear that ;) Good luck with your app!

            – Paulo Mattos
            2 days ago















          1














          Unfortunately, there isn't an exported API to set the PDFView desired bouncing behavior.



          Having said that, you can (safely) exploit a PDFView implementation detail to hack your way around it for now:



          extension PDFView 

          /// Disables the PDFView default bouncing behavior.
          func disableBouncing()
          for subview in subviews
          if let scrollView = subview as? UIScrollView
          scrollView.bounces = false
          return


          print("PDFView.disableBouncing: FAILED!")





          and then use it like this in your code:



          pdfView.disableBouncing()


          Caveat. Please keep in mind that such solution might break in future iOS releases. Nevertheless, rest assured your app won't crash as a result (you only won't be disabling the bouncing behavior at all).






          share|improve this answer

























          • Hi Paulo, thanks for the reply. Unfortunately this doesn't have any effect. However thanks for letting me know I'm not missing a 'bounce' behavior attribute. Might have to wait for an update on PDFKit form apple.

            – Nicholas Farmer
            Mar 22 at 13:22











          • @NicholasFarmer Hmm... I did a quick test here and was able to successfully disable the bouncing behavior on the PDFView. Will upload a short gist when I get a chance...

            – Paulo Mattos
            Mar 22 at 15:24












          • Hey @NicholasFarmer, run this code in a Swift Playground in Xcode (be sure the Live View is showing) and you will see that the vertical scroll bouncing is indeed disabled. Comment out the pdfView.disableBouncing() line to enable it back.

            – Paulo Mattos
            Mar 22 at 20:24







          • 1





            Hi Paulo, apologies for the late reply. I went back and re-tested and still didn't work...however after recent update and upgrade to swift 5 - this now works beautifully. Many thanks for your input. Your answer has been accepted and upvoted. Kind regards

            – Nicholas Farmer
            2 days ago











          • Hey @NicholasFarmer, glad to hear that ;) Good luck with your app!

            – Paulo Mattos
            2 days ago













          1












          1








          1







          Unfortunately, there isn't an exported API to set the PDFView desired bouncing behavior.



          Having said that, you can (safely) exploit a PDFView implementation detail to hack your way around it for now:



          extension PDFView 

          /// Disables the PDFView default bouncing behavior.
          func disableBouncing()
          for subview in subviews
          if let scrollView = subview as? UIScrollView
          scrollView.bounces = false
          return


          print("PDFView.disableBouncing: FAILED!")





          and then use it like this in your code:



          pdfView.disableBouncing()


          Caveat. Please keep in mind that such solution might break in future iOS releases. Nevertheless, rest assured your app won't crash as a result (you only won't be disabling the bouncing behavior at all).






          share|improve this answer















          Unfortunately, there isn't an exported API to set the PDFView desired bouncing behavior.



          Having said that, you can (safely) exploit a PDFView implementation detail to hack your way around it for now:



          extension PDFView 

          /// Disables the PDFView default bouncing behavior.
          func disableBouncing()
          for subview in subviews
          if let scrollView = subview as? UIScrollView
          scrollView.bounces = false
          return


          print("PDFView.disableBouncing: FAILED!")





          and then use it like this in your code:



          pdfView.disableBouncing()


          Caveat. Please keep in mind that such solution might break in future iOS releases. Nevertheless, rest assured your app won't crash as a result (you only won't be disabling the bouncing behavior at all).







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 2 days ago

























          answered Mar 21 at 20:58









          Paulo MattosPaulo Mattos

          11.5k53855




          11.5k53855












          • Hi Paulo, thanks for the reply. Unfortunately this doesn't have any effect. However thanks for letting me know I'm not missing a 'bounce' behavior attribute. Might have to wait for an update on PDFKit form apple.

            – Nicholas Farmer
            Mar 22 at 13:22











          • @NicholasFarmer Hmm... I did a quick test here and was able to successfully disable the bouncing behavior on the PDFView. Will upload a short gist when I get a chance...

            – Paulo Mattos
            Mar 22 at 15:24












          • Hey @NicholasFarmer, run this code in a Swift Playground in Xcode (be sure the Live View is showing) and you will see that the vertical scroll bouncing is indeed disabled. Comment out the pdfView.disableBouncing() line to enable it back.

            – Paulo Mattos
            Mar 22 at 20:24







          • 1





            Hi Paulo, apologies for the late reply. I went back and re-tested and still didn't work...however after recent update and upgrade to swift 5 - this now works beautifully. Many thanks for your input. Your answer has been accepted and upvoted. Kind regards

            – Nicholas Farmer
            2 days ago











          • Hey @NicholasFarmer, glad to hear that ;) Good luck with your app!

            – Paulo Mattos
            2 days ago

















          • Hi Paulo, thanks for the reply. Unfortunately this doesn't have any effect. However thanks for letting me know I'm not missing a 'bounce' behavior attribute. Might have to wait for an update on PDFKit form apple.

            – Nicholas Farmer
            Mar 22 at 13:22











          • @NicholasFarmer Hmm... I did a quick test here and was able to successfully disable the bouncing behavior on the PDFView. Will upload a short gist when I get a chance...

            – Paulo Mattos
            Mar 22 at 15:24












          • Hey @NicholasFarmer, run this code in a Swift Playground in Xcode (be sure the Live View is showing) and you will see that the vertical scroll bouncing is indeed disabled. Comment out the pdfView.disableBouncing() line to enable it back.

            – Paulo Mattos
            Mar 22 at 20:24







          • 1





            Hi Paulo, apologies for the late reply. I went back and re-tested and still didn't work...however after recent update and upgrade to swift 5 - this now works beautifully. Many thanks for your input. Your answer has been accepted and upvoted. Kind regards

            – Nicholas Farmer
            2 days ago











          • Hey @NicholasFarmer, glad to hear that ;) Good luck with your app!

            – Paulo Mattos
            2 days ago
















          Hi Paulo, thanks for the reply. Unfortunately this doesn't have any effect. However thanks for letting me know I'm not missing a 'bounce' behavior attribute. Might have to wait for an update on PDFKit form apple.

          – Nicholas Farmer
          Mar 22 at 13:22





          Hi Paulo, thanks for the reply. Unfortunately this doesn't have any effect. However thanks for letting me know I'm not missing a 'bounce' behavior attribute. Might have to wait for an update on PDFKit form apple.

          – Nicholas Farmer
          Mar 22 at 13:22













          @NicholasFarmer Hmm... I did a quick test here and was able to successfully disable the bouncing behavior on the PDFView. Will upload a short gist when I get a chance...

          – Paulo Mattos
          Mar 22 at 15:24






          @NicholasFarmer Hmm... I did a quick test here and was able to successfully disable the bouncing behavior on the PDFView. Will upload a short gist when I get a chance...

          – Paulo Mattos
          Mar 22 at 15:24














          Hey @NicholasFarmer, run this code in a Swift Playground in Xcode (be sure the Live View is showing) and you will see that the vertical scroll bouncing is indeed disabled. Comment out the pdfView.disableBouncing() line to enable it back.

          – Paulo Mattos
          Mar 22 at 20:24






          Hey @NicholasFarmer, run this code in a Swift Playground in Xcode (be sure the Live View is showing) and you will see that the vertical scroll bouncing is indeed disabled. Comment out the pdfView.disableBouncing() line to enable it back.

          – Paulo Mattos
          Mar 22 at 20:24





          1




          1





          Hi Paulo, apologies for the late reply. I went back and re-tested and still didn't work...however after recent update and upgrade to swift 5 - this now works beautifully. Many thanks for your input. Your answer has been accepted and upvoted. Kind regards

          – Nicholas Farmer
          2 days ago





          Hi Paulo, apologies for the late reply. I went back and re-tested and still didn't work...however after recent update and upgrade to swift 5 - this now works beautifully. Many thanks for your input. Your answer has been accepted and upvoted. Kind regards

          – Nicholas Farmer
          2 days ago













          Hey @NicholasFarmer, glad to hear that ;) Good luck with your app!

          – Paulo Mattos
          2 days ago





          Hey @NicholasFarmer, glad to hear that ;) Good luck with your app!

          – Paulo Mattos
          2 days ago



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55264330%2fios-pdfkit-disable-vertical-scroll-bounce%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

          용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

          155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해