So, Apple has a bug right now where if you type an Emoji into a UITextField, it will shift the text down. In fact, if you type enough emojis and then backspace, it'll shift the text even further down from where it was supposed to be. I confirmed this by trying UITextFields in Twitter, Snapchat and other apps.
Here is a video of my app displaying the bug.
Use this: textField.clipsToBounds = false
It prevents the textField to move when editing. Even when you try to edit it again.
(Tested on iPhone 6, iOS 10.0)
I don't think their would be a way around this, as it just seems that the emoji is changing the margin of the text inside of the UITextField.
Related
I have a UITextField, and the keyboard shows a mic button, which I'd like to disable. I'm especially concerned that it shouldn't show on iPhone X.
I already disabled the Emoji keyboard by setting the keyboard type to "ASCII Capable". Is there another setting to remove dictation?
We are talking about the mic symbol in lower right corner on an iPhone X.
You should not remove it since this is where users of an iPhone X are expecting it.
Also you can not remove the keyboard switcher on the left.
only if you use a custom view for the keyboard, but why?
As you can see on any other iPhone the mic key is still in the same position.
By changing type of keyboard you can discard things you don't want
textField.keyboardType = UIKeyboardTypeEmailAddress;
above one not exact solution but still that can give some idea regarding keyboard type
Hope this will help you
iOS - swift 3.0 : I am developing an iOS app with English and Arabic languages. In my password text field, which is in "secure text entry" mode, when I change the text input language of the keyboard from English to Arabic, it is still showing the caps lock indicator. I am not able to figure out any solutions for this strange issue. Pls help me out. Thanks in advance.
Note: I am not able to even reproduce this often, but my client reports this bug.
I am totally clueless. Looks like iOS bug?
Okay, assuming that the Arabic keyboard basically has no shift key (and further assuming that having pressed shift before on its English counterpart doesn't actually modify the input, i.e. it's just a graphical glitch) that sounds like a bug on Apple's part.
According to this answer (which is dated, but I assume still valid) you can't really change anything about the keyboard programmatically in this sense. I.e. you can't press a button like shift in code.
If it's really just a graphical issue and you can figure out when exactly the icon should disappear, you can work around it by overlaying your own image over the button (e.g. a white square to hide it), like so. I don't know which event or delegate method would immediately happen before the image needs to be set, though, you will have to figure this out with your users.
I'd furthermore suggest filing a rdar for Apple if it's really just a graphical issue.
Finally, I came up with a solution to hide the caps lock indicator of the textfield when it is in secureTextEntry mode.
//-------To hide caps lock indicator------//
let v = UIView(frame: CGRect(x: 0, y: 0, width: 0, height: 0))
self.passwordTextField.rightView = v
//----------------------------------------//
Basically, the caps lock indicator is presented on the right view of the UITextFiled by default, when the textfield is in secureTextEntry mode.
By assigning a view with zero dimension to the right view of the textfield , it just overrides that view with the new view(which has zero dimension) , hence the caps lock indicator never appears there after.
On iOS 10 in a UILabel, the letter יִ (a yud with a chirik under it) is getting displayed as a circle instead of the way it's supposed to appear.
Other vowels and letters (e.g. יֵ יַ יֶ יֹ) are being displayed ok.
I submitted this as a bug to apple (bug id 28561355 on https://bugreport.apple.com).
Even if apple can fix this in a future version of iOS, is there anything I can do now, to hack this to work? I can just replace the yud-chirik with a plain yud, but I'd rather try and keep the display as it's supposed to be.
Thanks.
UPDATE: It seems that if I change the font to the default apple font (instead of a custom font that I was using), then the yud-chirik appears, but the chirik appears in the wrong place. It appears directly under the yud instead of at the bottom with all the other vowels.
Here is my very simple code for creating a UITextView.
UITextView *textView = [[UITextView alloc] initWithFrame:self.view.bounds];
textView.editable = NO;
textView.text = #"Using iOS 3.0 and later, VoiceOver is available to help users with visual impairments use their iOS-based devices. The UI Accessibility programming interface, introduced in iOS 3.0, helps developers make their applications accessible to VoiceOver users. Briefly, VoiceOver describes an application’s user interface and helps users navigate through the application’s views and controls, using speech and sound. Users familiar with VoiceOver in Mac OS X can leverage their experience to help them quickly come up to speed using VoiceOver on their devices.";
[self.view addSubview:textView];
Given that I could not possibly do anything wrong here I am just wondering if this is an expected behaviour or a bug perhaps somebody also faced:
With voiceover enabled I expect the entire text view to be “highlighted” on tap, then its accessibilityLabel to be read to a user and after they double tap, the entire text view’s text to be read.
But what is happening is that a small portion of the text view is highlighted (usually 2 lines), accessibilityLabel is not read, but the first “highlighted" line and the first letter (!) of the second line are read instead and only after a user double taps the entire text is read.
Especially reading the first letter in the second highlighted line confuses me. Plus shouldn’t accessibilityLabel be always read in the beginning?
This looks like a big to me but Apple has always paid so much attention to accessibility, so I’m having doubts if I should report it, may be the meant it to be this way.
Another question: is there a way to achieve the following behaviour (without subleasing UITextView) when voiceover is enabled: user taps UITextView -> accessibilityLabel and the entire text are read?
In case someone else has this problem here is the answer:
textView.accessibilityTraits = UIAccessibilityTraitStaticText;
Combining the other two answers from this post has the desired effect. i.e.
textView.isAccessibilityElement = true
textView.accessibilityTraits = .staticText
Also if you are setting the attributedText property on the UITextView make sure you DO NOT set the accessibilityLabel (on the UITextView). Doing so will cause VoiceOver (Xcode 12.5, iOS 14.4.2) to read the text twice.
textView.isAccessibilityElement = true
This Works
Just noticed that in UITextView keyboard comes without change language button, unlike in UITextField. Why Apple removed this button from UITextView keyboard? Is there any way to enable this button? I want people to be able to write notes on any keyboard language added in phone settings.
EDITED: Maybe it will help somebody in the future. Just noticed that I set keyboard type to UIKeyboardTypeAlphabet and this option eliminates language button. Closing this question.
P.S. I have 3 languages enabled in test iPhone.
You are completely wrong. there is no difference in UIKeyboard in iOS whatsoever. It only depends on what keyboard types you use.
UIKeyboardTypeDefault and UIKeyboardTypeEmailAddress and UIKeyboardTypeTwitter all have those.
You set it like this:
txtField.keyboardType = UIKeyboardTypeTwitter;
UIKeyboardTypeDefault is obviously the default one for any UITextView or UITextField in iOS.
For anyone have this problem even when using UIKeyboardTypeDefault on a UITextView, go into the storyboard and make sure "Secure Text Entry" is unchecked. After unchecking this, the keyboard selector will return as well as the quick type keyboard.