I have a label which shows the pink area on the screen. However, the word "gender " is not shown in the top line even if it has enough space. Why is it not showing up in the first line itself? What I need
label.text = #"Do you believe in gender equality";
Label
The UILabel is working as intended by preventing an orphaned word so it’s more readable. This was introduced in iOS 11. Apple must disable it for iMessage because they probably intend this behaviour for long articles of text, not text messages.
I've seen fixes including
call sizeToFit on the label after the text has been set
setting UserDefaults.standard.set(false, forKey: "NSAllowsDefaultLineBreakStrategy") // Using this private tricky shortcut may leads appstore rejection.
But none of these are working on iOS 13, simulator (Not tested on devices).
Fix
One tricky solution is - append some spaces or two tabs("\t\t") to the text and set programatically.
Use following code:
label.lineBreakStrategy = []
Related
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.
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.
My app is getting crash on iOS7
In my app, I have language option. One is English and other is Kannada.
When user selects Kannada, all text turns into Kannada. I have one textview in which I have added static text in Kannada.
When user navigates to that view, the app crashes on iOS7 , while on iOS8 it's working fine.
I am not getting any log for crash. I can only see EXC_BAD_ACCESS (code = 1, ...) . I have tried it by keeping "Enable Zombies" option, still not getting any log in console.
P.S. - I have static text in textview. I am not adding text dynamically. I am just hiding/un-hiding textviews. I can see and read the text in Kannada in my textview in storyboard.
It may be a strange behavior in iOS 7, and it seems to be a bug in the way NSLayoutManager layouts the text for Kannada language. As other answers pointed out, UITextView is build around TextKit since iOS7, and thus uses NSLayoutManager internally to layout text.
I would like to get a down arrow to display inside a UILabel. Specifically ⬇ Unicode: U+2B07. This is show sort order on a column header.
I have seen the code to get unicode characters to display and when I use it for the symbol above it doesn't display as expected but rather comes up with a blue down arrow with gloss.
Has anyone seen this?
Displaying some characters as "Emojis" is a feature which is e.g. (controversially) discussed here: https://devforums.apple.com/message/487463#487463 (requires Apple Developer login). This feature was introduced in iOS 6.
A solution (from https://stackoverflow.com/a/13836045/1187415) is to append the Unicode "Variation selector" U+FE0E, e.g.
self.myLabel.text = #"\u2B07\uFE0E";
// or:
self.myLabel.text = #"⬇\uFE0E";
Note that on iOS <= 5.x, the Variation selector is not necessary and must not be used, because iOS 5 would display it as a box.
In Swift it would be
myLabel.text = "⬇\u{FE0E}"
If you're seeing the blue arrow with gloss, you have the right character, but it's showing one of the emoji-style characters. Try changing the font of your UILabel to something like Arial Unicode MS.
Edit After a little testing, it looks like changing the font doesn't actually work. It keeps displaying the glossy arrow. It's probably better to go with the suggestion of the other answer and use a different glyph, like \u2193, which does work:
[nameLabel setText:#"\u2193"];
I've got two UITextViews containing data that should be recongised by the data detection, however whilst one works fine on both device and simulator there's one that only works under Simulator. I've attempted trashing the build from my device, cleaning the product down, removing derived data and nothing seems to resolve the inconsistency.
Link detection was enabled within Interface Builder, the data is passed in with a NSString stringWithFormat: formatted string and set with UITextView setText:. Set the same way for both, so there's no difference there, but it just doesn't seem to work correctly for one of them.
EDIT: On the device if I tap on one of the items that should detect as a link, it'll then turn blue and do link detection. I'm not setting any custom fonts or colours that could have an impact.
It appears that the trick is to setScrollable:NO. Seems to fix the problem, although if you need scrolling, I'm not sure what the answer will be...
Apparently this issue is caused by how iOS is currently handling the UITextView links. It is creating an NSAttributedString that turns sections of the text blue ( when the view contains a link ). So I've figured out that this bug only occurs when a link is the first text in the AttributedString, i.e. the first text in the text view. So it's easily fixed by prepending an whitespace to your text before setting it. Or overriding setText to " " + text;
Hope this helps guys