UITextField cursor position change when orientation changes

Works fine with iOS6 even if I change orientation Working fine with iOS6

Works fine with iOS7 unless I change the orientation Working fine with iOS7

Display error when changing the orientation of iOS7. * Error in display when orientation gets change iOS7

I create a UITextField programmatically, its working tone with <iOS7,

with iOS7 and above, when I change the orientation of the UITextField , the cursor position changes. What is the problem? Is this an iOS bug?

The UITextField corners of the UITextField that you see are only UITextField , I'm just rounded by setting the angle of the UITextField .

I set the left and right view of UITextField . Also in the method of changing the orientation, I do not even touch this UITextField .

Update:

I find that there contentOffset changes in UIFieldEditor subview UITextField

 - (void)resizeUITextFieldInsideUITextFieldWithOffset:(CGFloat)y { for(id subview in [txtSearch subviews]) { if([subview isKindOfClass:[UIScrollView class]]) { UIScrollView *textField = (UIScrollView *)subview; [textField setContentOffset:CGPointMake(0, y)]; } } } 

I fix this using the above code in orientation, but when I type in the same problem again, it repeats again.

+7
ios uitextfield cursor-position uiinterfaceorientation
source share
2 answers

Try to resign when you are about to spin, and again set as the first responder as soon as you finish spinning. I do not understand why this is happening, but it should try. Do you have autostart?

+1
source share

Uiviwcontroller change enter image description here fixed the problem for me, random error.

enter image description here

+7
source share

All Articles