What is this Text Styles thing in Interface Builder? - ios

Wondering if there is some way to modify the properties found in this Text Styles dropdown on interface builder. Not sure how to find any docs relating to this.

Text Styles
Text Styles are semantic descriptions.
There are a fixed number of descriptions, and currently, in iOS 9,
10 styles are supported:
Title1, Title2, Title3
Headline, Subheadline
Body
Footnote
Caption1, Caption2
Callout
Use this link for reference
https://developer.apple.com/reference/uikit/uifontdescriptor#//apple_ref/doc/constant_group/Text_Styles

Related

Highcharts - Is there a way to disble styled mode for certain elements?

We are using Highcharts styled mode in our project and very happy about it.
However, css object (inline styles) in certain situations better works for us.
For example, legend.itemStyle property with {textOverflow: undefined, width: "dynamically calculated width"}
I'd like to know if there is a way to "overwrite" styled mode setting only for legend styles or give the inline style higher precedence for this particular situation.
JSFiddle example
Hope it makes sense.
You can set your own custom style for certain elements.
In styled mode, the legend items can be styled with the .highcharts-legend-item class.
Demo: https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/css/legend/
API: https://www.highcharts.com/docs/chart-design-and-style/style-by-css
API: https://api.highcharts.com/highcharts/legend.itemStyle

Multiple hyperlink colors in an iOS UITextView

I'd like to be able to show a UITextView that has multi-colored hyperlinks (ie, some hyperlinks red, some blue, some green, etc.)
No matter what I set NSForegroundColorAttributeName to for the given range of the hyperlink it always seems to get overwritten by whatever is specified in myTextView.linkTextAttributes.
Is there a way I can disable the linkTextAttributes functionality or override its styles on a per-range basis?
You can find my full tutorial about multiple hyperlink colors here: https://octodev.net/changing-uitextview-hyperlink-color/
Tutorial contains implementation in both languages: Swift and Objective-C.
Would be more than glad to answer all your questions.

How to highlight or change color of text within iOS?

I would like to highlight or change the color of certain words within text, like when you search for a term, you get the highlighted words within search results.
I know I can't do this with NSStrings, but How will I able accomplish this? I would like to display text in UITextView, but can do other options if I need to.
Thanks
In iOS 6 you can do it, because iOS 6 now allows UITextView (as well as UILabel, UIButton etc.) to display styled text (NSAttributedString). You color the word with NSForegroundColorAttributeName and color its background with NSBackgroundColorAttributeName and presto, there's your highlight. There are several very good WWDC 2012 videos on this topic.
The only way I can think right now will be using an UIWebView and using CSS and javascript to highlight words.
You can check this stack overflow answer fo an example of how to highlight text with jQuery and CSS.
Also you can check this example
I prefer using EgoTextView, you can change color for range of texts. Please check the code here.

How use different font styles and icon in a Firemonkey stringgrid cell

There seems to be not much information available about this subject so hopefully someone can give some suggestions.
I would like to change color and style of different parts of text in a stringgrid cell.
Example:
20-02-2011 - Document Title
Would it also be possible to show an icon in a stringgrid cell?
It is indeed possible to show icons or bitmaps in a string grid, the Monkey Styler blog includes an example of how to customise cell display in a FMX grid.
http://monkeystyler.com/blog/entry/firemonkey-grid-basics-custom-cells-and-columns
Thinking about the other part of your question though, you will have to build a style up to display text in different fonts, as yet FMX does not have a richtext equivalent or HTML rendering components (I'm sure the latter will come, the former I am not confident on getting for a while!). You would have to have a text component in the style for each different font size/style etc, you would need to name the text elements (using binding or stylename properties) and handle the setting of the text contents using code in the ongetvalue and onsetvalue events (I guess you could also use a onapplystyle event) to display some text in bold and some not.
The event handler would then use either a binding - which is easier to set but - in my experience - buggy;
mycell.binding['boldtext']:='sometext';
Or find a style element by stylename by using findstyleresource;
tempobj:=mycell.findstyleresource('boldtext');
if tempobj is ttext then
ttext(tempobj).text='sometext';
Excuse any bad coding style there, but you get the general idea (I hope) if you set autosize to true for the ttext components in the style and align them left you get - mostly - what you are after. The only issue is that the resulting text doesn't look quite seamless because autosizing and aligning left doesn't really give you the same space between the fonts that you would get with a richtext or HTML display. You should be able to fiddle with the padding (giving it a negative number for the left padding should allow you to remove any extra space) but you have to live with that not being entirely perfect compared to proper font hinting and alignment.

Display simple markup in a Label in Delphi

I am currently displaying some text in a TLabel. I would now like to emphasise certain words within the text by displaying them in bold or perhaps italic. What is the recommended way to do this in Delphi? Is there a TLabel-like component that can display simple HTML or markup?
I am imagining some code like this:
label.text:='This information is <b>important</b>';
I am using Delphi 2010
JvHTLabel in the JVCL will do the trick very nicely. Download the whole library from http://jvcl.delphi-jedi.org/
Check the THtmlViewer components are free and compatible with delphi 2010.
One more:
Delphi Markup Label
The Delphi Markup Label is a label component for Delphi that supports some HTML-like tags to format the displayed text. Amongst others, it supports tags for hyperlinks, tabs, font size, color and styles. The full list of tags can be found in the accompanying test tool.
http://www.infintuary.org/stlabel.php
Single pas file, compiled demo included. Some formatting is implemented via self-made tags so it won't be classic HTML. Has no transparence.
If you are already using a newer version of Delphi (at least the XE2 version), you can take a look at my TDzHTMLText component at: https://github.com/digao-dalpiaz/DzHTMLText
This component is a label with some HTML tags support, allowing you to format the text with Bold, Italic, Underline, Font Color, Font Size, Background Color, Tab Alignment, Text Alignment (left, center, right).
Check a print example:
DzHTMLText component example at design-time
The list below describes all possible tags to format label text:
<A[:abc]></A> - Link
<B></B> - Bold
<I></I> - Italic
<U></U> - Underline
<S></S> - Strike out
<FN:abc></FN> - Font Name
<FS:123></FS> - Font Size
<FC:clColor|$999999></FC> - Font Color
<BC:clColor|$999999></BC> - Background Color
<BR> - Line Break
<L></L> - Align Left
<C></C> - Align Center
<R></R> - Aligh Right
<T:123></T> - Tab
<TF:123></TF> - Tab with aligned break
Some ideas:
Have a look at TLinkLabel in ExtCtrls.
It lets you add links.. it paints the linked part underlined. Maybe you can steal the code and add support for other tags like <b> <i> <strong> <em>?
You can use a TRichEdit component.. It's not HTML as you describe, but it should do the trick of formatting your text.
Use TjanMarkupLabel from this page.
"TjanMarkupLabel is a TGraphicControl descendant that renders its Text property in HTML style. Supported tags: Bold, Italic, Underline, Font (face, size and color) and Break."

Resources