uilabel

Cocoa Touch - Custom UILabel

I am trying to create a custom UILabel which sets the background colour to clearColor (with added functionality further down the line). This way, I don't have to specify the exact properties for each label as they will be inherent in every instance of the label. I have tried several variations on a them but with no success, what am I do...

UILables not updating properly in a UITableViewCell

Hi there, been having this problem for a few days now and can't seem to find a solution for it. It's probably some very basic stuff but still can't come up with a solution. I have a bunch of labels nested inside table view cells with an edit navigation controller button that goes to another table view. This table view has text fields t...

[myLabel setText:] only works if I use an intermediate variable

I am trying to set the text of a UILabel to be equal to the name of the day of the week represented in an NSDateComponents. I am using the following code: NSDateComponents *dateComponents = [[[NSDateComponents alloc] init] autorelease]; dateComponents.weekday = 1; //Sunday NSString * const weekdayNames[8] = {@"Array starts at 1", @"Sun...

XML Parsed data into a Custom View with UILabel instead of UITableView

Hello future friends who is gonna help me big time on this project, I have these Books parsed from XML file (adopted from this post I found). First view (RootViewController) has a list of book titles in a UITable. When user clicks on one of the books, instead of viewing the books detail (BooksDetailViewController) in a second UITable, I...

iphone uitableviewcell - mulitiple colors in the same cell textLabel?

cell.textLabel.text = [NSString stringWithFormat:@"your name: %@", yourName]; I need yourName to appear in red (while "your name" stays the default black color). Possible? How? ...

Why is the UILabel text only on the first page of the UIScrollView

My scrollView shows images downloaded from a server. Now i want to show additional information in an UILabel. However this is only shown under the first image. When scrolling the UILabel is not shown :-( (void)populateImageArray:(NSNotification *)notif { NSUInteger i; CGFloat contentOffset = 0.0f; for (i = 0; i <= [items c...

How to resize UIlabel inside UIView proportionally ?

Hi, I have a UILabel inside a UIView and I want the label to be resized proportionally as the UIView is resize. I was able to do so with a UIImageView but the label stays as big as I placed it in IB. I have set the view contentMode to UIViewContentModeScaleAspectFit thinking that anything inside the UIView would be "aspect fit" but I ...

number of lines in UILabel

I need to get the number of lines in a UILabel, so that I can move another UILabel to be at the bottom of the last line of text. I have done: int lines = [cellDetailTextLabel.text sizeWithFont:cellDetailTextLabel.font constrainedToSize:cellDetailTextLabel.frame.size lineBreakMode:UILineBreakModeWordWrap].height /16; but well it's not ...

How to display an array of UILabels?

I have a list of items I'd like to show in a UITableViewCell. Right now, I'm simply using a cell.textLabel with commas separating each value, but I'd like to do something a little more dynamic. How would I achieve something like this? Would it be an array of UILabels with borders and radius on those borders? Thanks for your ideas. ...

iPhone UILabel Hidden weirdness between OS 3.0 and 4.0

When I initially load my view there is a spinner and "Loading..." label displayed. However, after my data is loaded, the spinner and label appear on screen for a good 2 seconds. I did some debugging and my method is getting called and completes before these elements hide. It's like there's a lag. The method: - (void)isLoadingData:(BOOL...

UIlabel - link text property with another NSString

Is it possible to "link" UILabel text property with another NSString so that when this other NSString is changed also UILabel text property changes? Example: UILabel *label = [[UILabel alloc] init]; NSString *str = @"labelText1"; label.text = str; str = @"labelText2"; //after this assignment label.text is still "labelText1" ...

How can I force a UILabel to cover the background of its parent UIView?

I'm having a problem I most definitely don't understand. I have the following subclass of UIView: @implementation TimelineSystemEventView - (id)initWithFrame:(CGRect)frame { if ((self = [super initWithFrame:frame])) { CGRect newFr = CGRectMake(-30, 0, 60, 25); label = [[UILabel alloc] initWithFrame:newFr]; [self addS...

Dynamic UILabel content inside of a UIScrollView

I've got a UILabel (amongst other controls) stored within a UIScrollView. I want to dynamically populate the UILabel so that it automatically expands its height to fit its contents. I'm just wondering what the best practice is with regards to resizing the UILabel while also ensuring that its parent UIScrollView will also expand its scrol...

Calculate cell height based on number of lines?

I'd like to make a custom UITableViewCell height using (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath. I'm trying to get the height of the UITableViewCell by multiplying the number of lines in textLabel by the height of each line and then adding 10.0f for the subtitle. I am using the follow...

UILabel backgroundColor in UITableViewCell always reverts to initial value

In my app, I have a UITableViewCell which is used to display a background color setting. In the detailTextLabel, it displays the name of the color with the background set to the actual color, e.g. [UIColor cyanColor]. Note that I am setting the background of the detailTextLabel only, not the whole UITableViewCell. When users tap on the c...

how to centre my text label to centre of navigation bar

how to find length of the navigation bar.... i want to display a label centre of the navigation bar programmatically.. so that i can write formula ,so it should work if i rotate my device ... ...

iPhone Problem with custom cell

I try this code but it's a mistake because i have a repetition of title and description... Someone can help me please? - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; CustomCell *cell=(CustomCell *)[tableView dequeueReusableCellWithIden...

is it true no italics for iPhone 4 ?

In my project, the iPhone 4 does not show italics for command textLabel.font=[UIFont italicSystemFontOfSize:16]; but the iPhone 3 shows italics properly. Is it true that iPhone 4 does not support italics? If not using systemFont, can you get italics? thanks, Gary ...

How to get (x,y) location of the sub-string from Multiline UILabel text (iPhone SDK) ?

How to get (x,y) location of the sub-string from Multiline UILabel text (iPhone SDK) ? i.e. : I am having a multiline label.. Now i want to get origin-location of the substring of UILabel.text? suppose this is my string displayed in Multiline UILabel : "KDDI's 'smARt' television viewing concept links phones to consumerism at long l...

iphone - UILabel - How to align to top left

I'm having a 4 line label in my iPhone app. When my label text is small, the label is centered vertically. But I want to start at topleft corner of the label. I used following code, still not working. campaignDescription.baselineAdjustment = UIBaselineAdjustmentNone; How to achieve this? ...