iOSTextArea is not scrolled to the top when in a modal view

I am experiencing a strange thing with an iOSTextArea that contains more text than it’s height (requires scroll to read it all). The textarea is on a modal view from iOSDesignExtensions. When the modal is called, the textarea is scrolled down where about 2 or 3 of the first lines are hidden. I have the top constraint set to TopLayoutGuide.Bottom + standard gap. I even tried placing a label above the textarea with the constraints as above, and the textarea’s top is the label’s bottom plus standard gap, but this still happened. Is there something I am missing?

Hi Ryan,
I’m currently on vacation. Could you set up a demo project that shows the issue and share it here?
I’ll be able to have a look tomorrow evening

Hi Jeremie. Yes, I will put together a mock app tomorrow and will post here. Thank you for taking the time to look into it. Enjoy your vacation!
Ryan

1 Like

Hi all. Here is a sample project

There are two buttons at the top, both which point to the same view. The difference is one uses the modal and other PushTo. These have different results

And there’s a bonus discovery. On the bottom of the home view in the sample, there are 2 additional buttons, which go to a different view. This view has a textarea with the bottom set to the parent vertical (half way down). I placed some controls below the textarea. When run, the text in the textarea bleeds over the controls on the bottom half. This happens with both modal and PushTo, so assuming this is a bug and not related to Jeremie’s control extensions. If you agree this may be a bug and want me to file a bug report, lmk. It’s been a while since I’ve done one

Side note. I am using 2019 r3. Note, this is not 3.1 or the latest 3.2. Just in case this was a discovered bug that was fixed in 3.1

Thank you for the example project.

I tested in the old iPhone SE simulator (iPhone 5 screen size) and I have the same behaviour on both modal and non modal views: TextArea is scrolled down by 2 lines.

It seems this isn’t a Xojo bug as I found several similar questions on Stackoverflow.

Solution:

Add a method to the view:

Private Sub ScrollToTopDeferred()
      
      TextArea1.ScrollToXC(new Xojo.Core.Point(0,0), False)
      
End Sub

And this line in the View’s open event:

xojo.core.timer.CallLater(50, AddressOf ScrollToTopDeferred)

Awesome! Thanks for confirming and the solution. I’ll give it a go tomorrow morning

Did you also see the “bonus” bug I found with the TextArea overlapping the controls of the TextArea bottom constraint is not at the bottom of the screen? Is that a Xojo bug or Apple bug?

1 Like

I actually missed that bug because I can’t reproduce it.
Using:
Xojo 2019r3.1 / Xcode 11.0 / Tried multiple simulators

This did the trick perfectly. Thank you!

Must just be my versions. I have 2019 r3.0 and Xcode 10.1. Perhaps the bug was fixed in 3.1. This is what I see. The line in the middle is a separator. The TextArea’s bottom is right above the line. Below the line are a couple controls. The scroll of the TA remains only in the upper half of the screen, where it is actually located, but the text bleeds over past it’s bottom and over the other controls

I’m holding out on updating Xojo. Waiting for 2020r1. Also waiting to update Xcode. I know I have to have Xcode 11 before being able to submit to the App Store. I always hesitate and see what everyone is using as sometimes the latest Xcode is incompatible with Xojo. It looks like the current Xcode release is 11.6. Is this Xojo compliant, or should I look for 11.5 or lower?

Thanks as always Jeremie!

Fixed in Xojo 2019r3.1
58593 Framework » iOS Fixed a regression which caused text in iOSTextAreas to overflow its bounds when the border was set to None or Rectangular.
Source: https://documentation.xojo.com/resources/release_notes/2019r3.1.html

I highly recommend updating Xojo to 2019r3.1 or 3.2 for iOS.
Regarding Xcode, I haven’t tested anything higher than 11.0 because I am still on Mojave and Xcode won’t update anymore.

That figures and happy it’s already been fixed. I’ll do the Xojo and Xcode update soon, probably after I put in a few hours of work so I can just let the download go for as long as it needs. Since you confirm 11.0 works with 2019r3.2, I will get onto Apple Developer and look for that one. Your advice is always much appreciated.

1 Like