Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Placeholder text gets wrong bounds when rotating into a portrait orientation #2

Closed
kschults opened this Issue · 7 comments

2 participants

@kschults

If I rotate the emulator (have not tested on a device), the placeholder text gets squished into the left side of the text view when rotating into a portrait orientation. It looks fine starting vertically, and works fine horizontally, but once I've rotated it, it won't work vertically.

@kirbyt
Owner

I did some research on this problem. It seems to be an issue on iOS 4.x. I'm not able to determine if the issue exists on iOS 3.x because Xcode isn't playing nicely with my iOS 3.1.3 device. I'm not able to recreate the problem under iOS 5. Rotation under iOS 5 works fine.

I'm assuming you are testing on iOS 4.3 or earlier correct? If so then my recommendation is move up to iOS 5.

-KIRBY

@kschults
@kirbyt
Owner

I'm not able to recreate the problem under iOS 5 using the Xcode 4.3. I've tried the simulator and on the device. I'll take another look though.

-KIRBY

@kschults

I was just able to recreate it using Xcode 4.2, both on the simulator and the device. If you'd like, I can link some screenshots. Might it be an issue in Xcode?

@kschults

The issue seems to stem from calling [_placeholder sizeToFit] inside drawRect. This means that it's getting called every time it rotates, and that's messing up the bounds of the placeholder view. I've solved it by checking against a flag of whether or not it's already been called before calling sizeToFit, and that resolves the issue. Is there a better way to do this?

@kirbyt kirbyt closed this issue from a commit
@kirbyt Fixes #2 rotation issue.
This fixes the rotation issue where the placeholder text would moving
out of bounds when the device is rotated. Also fixed a memory leak
found in -setup. And refactored out two ivars.
046e1a4
@kirbyt kirbyt closed this in 046e1a4
@kirbyt
Owner

I changed the way the height of the placeholder text is sized. This means I was able to remove the sizeToFit calls, and it fixes the rotation issue on earlier versions of iOS.

@kschults

Excellent, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.