Been coding for > 20 years, but there's nothing more humbling than learning a new platform :)
Hopefully I'm not missing something silly, but I can't find a similar issue here or elsewhere on the web.
I have a UI that looks correct in Interface Builder,
but at runtime, the text in the UITextView doesn't seem to wrap, and it doesn't seem to use the font that I've chosen in IB.
I even outputted the font in viewDidLoad at runtime, and it says it's using the correct font, but visually it isn't. All fields (regardless of font selected in IB) seem to display using the default font.
Hoping someone can point out what is likely a newbie mistake, or what else I could do to diagnose.
Thanks in advance
Related
I have been trying to not ask basic questions on stack overflow, but I cannot find a clue on the Internet related to this problem.
I wish to make my UILabel display multilines in my widget (Today Extension).
The "set lines to 0" solution works in the main app, but this doesn't seem to work within the widget. It keeps displaying only one line with '...' at the end.
Does anybody know how to resolve this issue? I will attach some screenshots to explain my problem further.
Increase the line limit number to 3 or more.
You can test the multiline wrapping by typing in the label yourself.
I know that setting it to '0' is suppose to work however when it comes to alerts and displays it does not always apply. I know that by giving it a number like '3' or '4' it is not dynamic, however, it will solve your problem with the notifications.
Alternatively you can use the "Autoshrink" feature, you can change it to minimum font size. By doing so, the application will shrink down the text to the font size you provided.
Some developers will also suggest checking the box, 'tighten letter spacing'
hope this helps.
I've been trying to make a project that creates Flash Cards , and i wanted to make the user be able to input any text on either sides of the card , the problem I'm facing now is that since the textbox(from TextMeshPro or regular one) has certain font whenever I try to input another languages like Japanese or Arabic it simply shows as squares, I tried the suggestion to use the textmesh pro dynamic font feature but still with no luck.
my question is , is there any way to do what I'm asking for without using fallback assets for every single language?
are there any unity plugins that do the job?
Like I said the aim is to make a textbox that displays whatever language is put in it.
any tips would be appreciated
NOTE: the solution doesn't need to use textmeshpro , it can use standard text component or any other custom ones.
I think the problem is the font. You will need a font that supports all the characters.
Perhaps you could use different fonts for different languages.
TextMeshPro creates a texture from the fonts characters. This texture will get very large if you have a lot of characters (e.g. for chinese). Because of that, the standard Text-component should be easier to work with.
(But I don't exactly know how the dynamic font feature of TextMeshPro works.)
So Since this is the first time I've worked with Fonts it appears that I didn't quite understand how fonts work and now I found the right way to approach the problem so I will give here the steps that I used to solve the multi-language issue:
1)you need a Font that supports as many languages as possible i found out that "Ariel Unicode" fits this need quite well with support to most common used languages support
2)you need to create a TextMeshPro Dynamic font asset that uses the font chosen in step one. (I tried using TextMeshPro Dynamic font before but i was mistakenly under the impression that the dynamic feature "search" for a font that has a certain character rather than we need to supply the font and it searches within the font for a character, that was a bit of a stupid assumption at my part created from the fact that I didn't understand how fonts work) .Here is a link how to use Dynamic SDF textmeshPro
I hope this helps someone with this process.
Xcode 8.3.2
As as newbie, I'm trying to get acquainted with segues, constraints, text fields and Image Views...mainly the design elements. I'm trying to put together a cheesy recipe book of favorite recipes. I wanted to know what's the best approach to display rich text with bold text and bullet points? Labels seem to be my only option but I was wondering if there were other options? Any advice would be appreciated.
ViewController in Storyboard
As much for my approach, during my career I learned that textViews (aka C# RichTextBoxes) can be pretty tricky..
You can go with classical UILabel approach with lines in Interface Builder set to 0 and atrributedText, which contains bullet points:
This is a nice tutorial, but a bit old and would probably do it another way, but I guess for the purposes is fine...
https://wingoodharry.wordpress.com/2016/04/10/bullet-point-list-ios-swift/
I would like to state here, that TextViews are the last option everywhere with text...
Wish happy coding! :)
UILabels are best way to display text, you can use attributedText in UILabels which will enhance your UI. Multiline text is a add on.
Else try using AsyncDisplayKit.
I would like to know if there is any way to change title font without creating a custom view? Something like this:
annotation.title.font = UIFont.systemFontOfSize(12.0)
I searched around, everyone says that I have to create a custom view like this tutorial, but it is so complicated and it's in objective-c.
Hope somebody have a simple way to change the font.
Thank you.
I want to set 2 different fonts within the same UITextField and UITextView . How to do it?
Its a bit of work - you'll need to use Core Text and NSAttributedString to do this.
There are plenty of tutorials and examples, although I'd suggest using someone else's already-made UILabel subclass such as:
OHAttributedLabel
or
TTAttributedLabel
As these usually have some convenience methods to make handling a lot easier.
I would do it with 2 custom textfields overlaying, both backgroundcolor:clearColor, maybe stuffed on an image that represents the background.
I don't think it is possible to handle 2 different fonts within the same UITextField or UITextView. If you want to have different font style you can either set different font style within a UIWebView or use the coreText API.
Here are some links that might help:
iPhone Development - Setting UIWebView font
the official doc on core text: https://developer.apple.com/library/mac/#documentation/StringsTextFonts/Conceptual/CoreText_Programming/Introduction/Introduction.html
I know you already picked a valid answer but... don't do it that way... it's not worth it. Use a webview instead and draw everything with html.
In interface builder change Text View's Text field to Attributed. In that small editor that appears you can change the font/format/color of the selected text, like in any advanced text editor.