Tag: uilabel

iPhone – Using CGContextShowTextAtPoint to draw special characters

I am creating sub class for UILabel to adjust the character spacing. It works well. But when I use special characters as in Spanish or Japanese language, its not writing. Only english characters are written properly. Any solution on how to display them? – (void) drawRect:(CGRect)rect { // Drawing code CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSelectFont […]

NSLineBreakByWordWrapping on First Line but NSLineBreakByTruncatingTail For Second Line?

Is this possible? I want to have a two line label. On the first line, I want it to wrap on words. But for the second line, if the text is too long, I want it to truncate by tail and add the ellipses “…” after. Any ideas on the simplest way to do this?

How to write a Custom UILabel Class

In my project there is a huge number of UILabels available for each screen that’s why I have created one separate class for UILabel and I want to set all label properties in that class. But label properties and label also not adding in my MainViewController. My code: CustomLabel: #import “CustomLabel.h” @implementation CustomLabel – (id) […]

UIPicker font size for a certain column and row

I’m looking to change the font size of a certain column and row in a UIPicker. Basically there’s too much text that runs off the view and I’d like to size just that particular row in the 2nd column down so it fits? thanks for any help.

Objective C: Issue in calculating height of individual labels

I have a label added to a cell which has a dynamic height based on the text to be added to it. I have set my font size to be 12 as seen below: CGFloat height = [CustomCell getIndividualLabelHeight:text]; NSLog(@”height of commet:%@ is %f”,commentText, height); CustomOHAttributLabel *label = [[CustomOHAttributLabel alloc]initWithFrame:CGRectMake(CELL_TEXT_LEFT_MARGIN, 2*CELL_SPACING+totalCommentLabelHeight, CELL_CONTENT_WIDTH – (CELL_TEXT_LEFT_MARGIN*2), height)]; […]

Updating label text (dynamically) while executing another method

I am an iOS developer currently developing an iphone application. I have a simple question regarding updating the contents of a ViewController and I would greatly appreciate it if I can get someone’s feedback who is aware of this issue or have a suggested solution. I’m writing a method that constantly updates the text of […]

How to know the displayed text in UILabel?

I have an UIView containing two UILabels, in order to display a string. The first UILabel has a fixed size, and if the string is too long and can’t hold in this UILabel, I want to display the maximum characters I can in the first UILabel, and display the rest of the string in the […]

UILabel text not changing, however xx.title is working

I have two view controller. In first view controller I have list of names. When I click on that, I want the same name to be displayed in second view controller. I have below code. -(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { // PropDetailViewController is second view controller PropDetailViewController *prop = [self.storyboard instantiateViewControllerWithIdentifier:@”prop”]; ListOfProperty *propList = […]

UILabel animating improperly

For some reason, UILabel’s text wants to set its alignment without animation, and I cannot figure out how to get the text to animate along with the rest of the label. I have the following code right now: UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(40,200,100,50)]; [label setText:@”Label Name”]; [label setBackgroundColor:[UIColor blueColor]]; [label setFont:[UIFont systemFontOfSize:17.0]]; [label setTextColor:[UIColor […]

Word Wrap not working for UILabel

Using autolayout I can’t override my label in code. I’ve set the labels attributes in IB: Lines = 0, LineBreaks = Word Wrap, but I have my height set to a single line because due to what cell is selected determines what text goes in the label. So sometimes the label will only have one […]