uikit

What's the point of -setFormatWidth: or -formatWidth from NSNumberFormatter?

The documentation is hard to interpret on this topic. Does this value return me how many characters the calculated format string will contain? Or does it tell me how big actually that string is? Or can I tell it how big (in unit squares or "pixels") the output should be? Maybe someone can point out what this methods do... ...

What describes NSNumberFormatter -maximumSignificantDigits ?

There's no text in the documentation about what that means, but it sounds very important to understand in order to not run into trouble. Does someone know what that is all about the "significant digits" of a number? ...

Why does my NSNumberFormatter object print "2" for input 1.0?

That looks like a bug in the API: When my input CGFloat is 0.0, I get this: Input = 0.000000, Output = +0 When my input CGFloat is 1.0, I get this: Input = 1.000000, Output = +2 Obviously that's not what I want ;-) Now here is how I create that NSNumberFormatter object: NSNumberFormatter *formatter = [[NSNumberFormatter allo...

What's the difference between NSNumberFormatter -setMinusSign: and -setNegativePrefix: ?

I have tried both, separately [formatter setMinusSign:@"?"]; The first one does not change the minus sign at all in my string. Doesn't have any visible effect. If I have a negative value, I see something like -321,65. But not ?321,65 for instance. [formatter setNegativePrefix:@"?"]; Now, with that one I do get a ?321,65 for a float...

Why would this NSNumberFormatter not display all fractional digits?

I have a NSNumberFormatter instance like this: NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init]; [formatter setAlwaysShowsDecimalSeparator:NO]; [formatter setAllowsFloats:YES]; [formatter setFormatterBehavior:NSNumberFormatterBehavior10_4]; [formatter setMinimumFractionDigits:0]; [formatter setNumberStyle:kCFNumberFormatt...

How to fit a String into a rectangle?

I have an NSString and want to fit it into a rectangle. The rectangle has a specified size, lets say width=150 and height=30. When the String is short and has only one character, it can be as high as the rectangle. More specific: It can have a big font size. But if the string has too much characters and would exceed the bounds of the rec...

Which iPhone system fonts can I use safely and which are recommended for what kind of display purpose?

Fonts are like a coin lost in the forrest: You're never sure where to look first. Had to say that ;-) Ok, so the problem: I come from the web dev world and my mind is screwed up completely regarding fonts. There is a UIFont class that can be used to specify how text in a label should look like. Unfortunately it seems I have to know a lo...

How to change color of label text?

In UIFont, I couldn't find a color property. What's the trick to make a font appear green, for example? ...

How to let the text in a UILabel appear blurry?

Is there a way to achieve a blurry or glowing effect for the text? Or would I have to fetch the graphics context of the layer and then apply some kind of gauss algorithm on the pixels? I searched the documentation on this but it appears that shadows don't draw blurry and there's no method in NSString, UIFont or UILabel that could help to...

How to provide easy multilanguage text in iphone app?

I have some short text that I want to ship in the currently active language. What's the most easy way to do it? Example: I have the text "the cat", but when someone from spain uses the app, he/she wants to read "el gato". Is there a standard way to do it easily with UIKit? They're pretty simple texts only. I can imagine some kind of prop...

How to calculate the width of a text string of a specific font and font-size?

I have a UILabel that displays some chars. Like "x", "y" or "rpm". How can I calculate the width of the text in the label (it does not ues the whole available space)? This is for automatic layouting, where another view will have a bigger frame rectangle if that UILabel has a smaller text inside. Are there methods to calculate that width ...

Where can I get the source code from apple's GLImageProcessing example?

I was reading on a blog that there's a GLImageProcessing example from apple. I couldn't find it on apple's site. Does anyone know where it is? ...

How to add a naked CALayer as "subview" to a UIView?

I think that adding a CALayer as "subview", somehow, does save a lot of memory. A UIView always comes with 3 copies of it's content bitmap (presentation layer, render tree and another one, plus the view itself, so every pixel is saved 4 times). But how could that be done? ...

What's the most precise data type for floating point calculations on iPhone OS?

I always thought it's double, until I accidently hit floo+ESC and it told me there is a floorl(<#long double #>) function. So long double is the solution to all big inaccuracy problems? ;-) Or is there even something more precise than that? ...

Is it a good idea to use NSDecimalNumber for floating point arithmetics instead of plain double?

I wonder what's the point of NSDecimalNumber. It offers some arithmetics methods, but why should I use NSDecimalNumber and not just double or NSNumber? Did apple take care of some floating point arithmetics uglyness there? Would it make life easier when making heavy use of high precision and big floating point maths? ...

Can't figure out where to start subclassing a UIControl!

Hi there, I want to create my own control that will consist of several UILabels and a couple of UITextFields. The problem is I'm not sure where to start! Do I directly subclass UIControl, then create my subviews and add them to the main view in init:? Or do I use layoutSubviews? And will I need to override drawRect:? I'm used to creati...

Adding a model layer (with caching) for UIWebViews; trouble with UIWebViewNavigationType and shouldStartLoadWithRequest

I'm tinkering with adding a model layer to an iPhone application so that I can serialize/prioritize HTTP requests and selectively cache responses. Thanks to UIWebViewDelegate, the following method makes this fairly straight forward (in theory): - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navi...

ViewController Transition notifications

Is there a way to track UIViewController transitions? As part of analytics, I would like to measure how long the user spends in each UIViewController without adding the code to all the controllers. ...

How to download files from internet and save in 'Documents' on iPhone?

I have a folder on my remote server that has a few .png files in it. I want to download these from within my app and store them in the apps 'Documents' folder. How can I do this? ...

How to get an NSarray of all file names in a directory on a remote server?

How do I get an NSArray of the NAMES of all files stored in a specific directory such as: "http://www.someurl/somedirectory/"? ...