Displaying on label - objective-c

I want to display some text means name of any source file with extension in a label. But the width is fixed and if the name is more than the width I want the name to be displayed like "Women Que...nnaire.jpg". Is it possible to display like this . If possible please let me know.

Set following in your label object:
adjustsFontSizeToFitWidth=NO;
lineBreakMode=NSLineBreakByTruncatingMiddle;
numberOfLines=1;

This is your answer;
Set :
lablel.adjustsFontSizeToFitWidth=YES;
Set Minimum font size of text;
lablel.minimumFontSize=10;// depends on you. How small font you want!

auto adjust size from label using this property using--
sizeToFit

Related

Is there a way to set minimum width on individual columns in C1FlexGrid?

Working with vb.net WinForms. I can set minimum width for the column collection of the flexgrid, but is there a way to make the minimum width different for each column? I cannot find anything that supports this. Pretty straightforward question but if any more info is needed let me know.
Newer C1FlexGrid versions provide the feature "Column.StarWidth", which is used to size all columns based on the available space in the parent control.
Here, you can specify a min width for each col:
c1FlexGrid.Cols(2).StarWidth = "*";
c1FlexGrid.Cols(2).MinWidth = 100;
See https://www.grapecity.com/componentone/docs/win/online-flexgrid/C1.Win.C1FlexGrid.4.5.2~C1.Win.C1FlexGrid.Column~MinWidth.html
The grid has a Cols property, you pass in the index of the column, then the Column has a width property:
Example:
grid.Cols[0].Width = 50
References
http://helpcentral.componentone.com/nethelp/c1flexgrid/C1.Win.C1FlexGrid.4~C1.Win.C1FlexGrid.C1FlexGrid.html
http://helpcentral.componentone.com/nethelp/c1flexgrid/C1.Win.C1FlexGrid.4~C1.Win.C1FlexGrid.ColumnCollection.html
http://helpcentral.componentone.com/nethelp/c1flexgrid/C1.Win.C1FlexGrid.4~C1.Win.C1FlexGrid.Column_members.html
http://helpcentral.componentone.com/nethelp/c1flexgrid/C1.Win.C1FlexGrid.4~C1.Win.C1FlexGrid.Column~Width.html

How should I determine the height of an NSAttributedString for a fixed width

I have an attributed string with "Date: Heading - Description."
The Date, Heading, and Description text values are dynamically generated, and all have different attributed fonts which I've assigned to the appropriate substring.
How should I determine the total width, and then consequentially the determine the height for a given width which this content should fill?
I've found this SO post but it is from 2010 and a more current solution seems like it would be available.
Additionally, how should the width of an attributed string with content changing text style by substring be determined? The iOS7 sizeWithAttributes method seems to apply the attributes for the entire string.
This is an attributed string, so the place to look is the NSAttributedString documentation. In particular:
https://developer.apple.com/library/ios/documentation/uikit/reference/NSAttributedString_UIKit_Additions/Reference/Reference.html#//apple_ref/occ/instm/NSAttributedString/boundingRectWithSize:options:context:
As to your last paragraph: simply make this a mutable attributed string, change the styles as desired, and proceed as above.

How do I use multiple different UIFonts in a UILabel?

I have an UILabel in my UIView. The text of my label is dynamic: it's a web service call which returns to me the text that I will put in my label. Here's an example of the content of the label:
"this is an example of my text/nthis is the second line".
I would like to put the first line in a specific font (Helvetica-Bold 12px for example) and the second line in another font (Helvetica 15px for example). How i can do this?
Thanks for your answers.
Honestly I'd recommend using two separate UILabel instances, take your text and get an array via [string componentsSeparatedByString:#"\n"], then place object at index 0 in the first one, and if you have a second object, put it in the second label.
You could go for a static UIWebView and simply wrap your text into HTML+CSS. This will be much easier than doing all the layout in code.
Maybe what you are looking for is NSAttributedString.
Here is a example: iphone/ipad: How exactly use NSAttributedString?

How to customize marker/symbol properties in matplotlib?

Example command:
prop = matplotlib.pyplot.scatter(x,y,s=s,c=c)
dir(prop) shows set_edgecolor, set_edgecolors, set_linestyle, set_linestyles - why so many variations on the same thing?
Also, how do I remove the edgecolors? Setting values to None does nothing. And how do I change the marker size after the plotting? There does not appear to be a markersize attribute that I can access...
Edit
If the symbols are generated through plyplot.plot, there is a markersize attribute to change it seems. But with pyplot.scatter, not present.
It'd give using 'none' a go to see if that solves your issue with edgecolor. That typically sets attributes to no color.

YUI3: Whats the best way to read Height of an element?

I want to increase height of an element by X pixels by writing a YUI3 script.
Whats the best way ?
if I use 'Node' module and read the height as node.getStyle("height");
The results of FF3 shows a string "100px" where as for IE8 its just blank. :(
Please help.
node.getStyle('height') only returns a value when you have a value set in the style of the node. To get the height of a node with out a style set use node.getComputedStyle('height') or node.get('clientHeight').
If you have overflow set, you can use node.get('scrollHeight') to get the full height of the content.
To update the height of the node, use setStyle('height', value)