uilabel

How to get "deselect" notification on UILabel

Hello! I have UILabel and I need it to be able support copy&paste (actually only copy as it is read only). I subclassed UILabel to support copy and it works fine. I also added text highlight so user knows what exactly is he copying when he clicks on label. My problem is that I don't know how to cancel that highlight when user clicks s...

iPhone Tap Counter

I'm trying to get a UI Button to interact with a UI Label through Xcode and Interface Builder. What should I change in this code to do so? (I have everything linked up in Interface Builder already. The app just crashes when I press the button.) @synthesize window; @synthesize label; @synthesize anotherLabel; @synthesize myButton; ...

Multiple UILabel(s) repositioning according to wordwrap.

Hi guys. I have this interface with multiple UILabels. On view loading i populate white labelled values with some data from a db. The problem is, some of that fields are potentially too long for the interface, so i'd like to compute the total height of one label once the text is word wrapped and reposition the 2 labels below (shifting t...

How to find out width of truncated UILabel text

I have UILabel, which contains dynamic text. Sometimes text is too long to be shown and thus automagically truncated. How do I find out width of the visible part of truncated text? sizeThatFits returns length of untruncated text, so at the moment I can only detect when truncation will be done. Need to know how much is visible, including...

How to stop view updates when app is in background (or sleeping)?

The Executing Code in the Background asks for "Avoid updating your windows and views". Because the UI updates are all over different views in various methods, what I can think of is setting a BOOL 'global' within each view controller (e.g. under the @implementation mapViewController), and use many if (BOOL) controls to stop updating IB...

UILineBreakModeTailTruncation in sizeWithFont:constrainedToSize:lineBreakMode: is ignored!

Hello, I'm using sizeWithFont:constrainedToSize:lineBreakMode: to calculate the actual height of a UILabel. However, the height I get is always based on the complete NSString (before it gets truncated). In fact, both sizeWithFont:constrainedToSize:lineBreakMode: and sizeWithFont:constrainedToSize: produce identical results as if the UI...

Using Core Graphics to paint a custom 'tab top' label

I've been coding with the iPhone SDK for nearly a year now and managed, up til now, to avoid Core Graphics. My question might therefore look quite simplistic. I need to implement a class that resembles a real-world 'folder tab'. Here's a mockup .. I've been getting by with UILabel, and have tried to subclass it, implementing a drawRe...

Providing editable and non-editable fields on the iPhone

I would like to present information to the user of my app in a non-editable way but allow editing after a button press (of the edit button). Is there any way of easily creating this transition from non-editable to editable? I have considered using UILabels for the non-editable fields and programatically removing them and showing UITextF...

How do I get a UIView which displays text to behave like a UILabel when bounds change?

I have a UIView in which I need to draw text in drawRect: - (void)drawRect:(CGRect)rect { ... [@"some text" drawAtPoint:somePoint withFont:someFont]; ... } Because the text requires special formatting, I cannot just use a UILabel. It looks fine until I rotate the device. Then the size of my custom UIView changes, and the ...

UILabel is not displaying the correct string

Hello! I have a UILabel I created on one of my views in my application. I have it set to a static text in IB, but I'm going to change that text programmatically. Here's how I was trying to do it. fahrenheitLabel.text = (@"Temperature: %@", text); //fahrenheitLabel is my UILabel //"text" is a NSString I expected the output to be ...

Display a unit on pickerview selection indicator?

I have a pickerview with 2 components allowing the user to select hours and minutes. I have seen many apps displaying a "hours" and "minutes" label on the selection indicator. How do i do this.? ...

issue with rotation and uilabels with size set using NSString's sizeWithFont...

I have a few UILabels in my view with their height set using sizeWithFont:. I set the autoreszingMask to flexible width and height, however on rotate the width changes (am assuming because self.view's width changes and its set with a width relative to self.view) but the height of it doesn't change to fit the content again. This results ...

Best way to strike out a text

Hi there Was is the best solution so far for a strike out text on the iPhone I heard of multiple solutions: Something wth three20 Image as a subview UIWebView and something with a NSAttributedString, but I don't find a working example for that. Cheers ...

Count down timer

I need a count down timer starting from 5 min. ...

Correct way to use sizeThatFits: and sizeToFit with UILabel?

Hi there At the moment I have a label being sized correctly using [aString sizeWithFont:constrainedToSize:lineBreakMode:] but I've introduced rotation into my device and with a flexible width and height this results in my UILabel stretching width ways (because its set relative to the main view) but not then contracting height-wise to co...

objective-c create a UIlabel with a hyperlink

hi all! what's the best way to create a label to link a web page? thanks in advance! Paolo ...

UILabel ghosting when printing NSInteger with transparent background

I have a UILabel in a UITableCell, and when I make the label's background transparent, I get these strange ghost characters (see image below), and it looks terrible. Here's my code: Left: UILabel *unreadLabel = [[UILabel alloc] initWithFrame:CGRectMake(270, 7, 25, 25)]; unreadLabel.text = [NSString stringWithFormat:@"%d", source.unread...