iphone

NSUserDefaults: What's the +resetStandardUserDefaults method good for? How can I provide "system settings"?

I want the user to be able to make some preferences like colors, prefered images, etc. When I use NSUserDefaults for this, on first start of the app there will be no preferences, right? So, every time I want to get a preference like NSInteger avatarID = (NSInteger)[[NSUserDefaults standardUserDefaults] objectForKey:@"avatar"]; I have t...

How simplify iPhone localization?

I need to localiza a in development app for English & Spanish. Despite the fact I follow the Apple way of use NSLocalizedString & create nibs for both, I already lost the track of the new string that need to get localized and found with surprise that I need to redo the nibs in spanish when I change the master. (Just like this http://ww...

iPhone - Setting background on UITableView

Is there any way to set a background view on a UITableViewController? I try with the code I am using on a UIViewController, but the view comes over all the contents of the table view, and if I add the background view in the cellForRowAtIndexPath-method, it is not showing at all. Anyone done this before or have an idea on how it can be d...

Pre-setting uislider values

Is there a way to preset UISlider values to something such as: 100, 121, 10000, 40505, 100000, 460322, 1000024, 5005230, etc... The numbers don't have a pattern. As the user moves the slider, I'd like to display the above numbers as corresponding to where the user is on the slider. The slider displays numbers in specific increments a...

Make an NSURL with an encoded plus (%2B)

I need to pass a timestamp with a timezone offset in a GET request, e.g., 2009-05-04T11:22:00+01:00 This looks like a two arguments "2009-05-04T11:22:00" and "01:00" to the receiving PHP script (over which I've no control). NSURL doesn't encode plus signs, but if I make an NSURL using the string 2009-05-04T11:22:00%2B01:00 t...

How can I reset the NSUserDefaults data in the iPhone simulator?

I've added NSUserDefault data retrieval to my app, which is pretty nice. But for testing I would like to reset all the data I added to the defaults database, so that everything is in the state when the user launches the app the first time. I tried to call: [NSUserDefaults resetStandardUserDefaults]; but that doesn't do anything. The d...

How can I detect if the user just wanted to scroll, and not tap on an UIImageView inside a UIScrollView?

I've implemented an UIScrollView which contains a grid of UIImageView objects. For both, the superview and it's subviews, userInteractionEnabled is YES. As the user scrolls and his/her finger touches an UIImageView, it imediately recognizes a tap on that, which is not what I want ;) Inside of that UIImageView objects I have this method:...

How can I make a view that's managed with an Tab Bar fade smoothly in/out rather than flashing hardly in/out?

I have an Tab Bar controller and a nice tab bar on the bottom of my app. There are three buttons. When I tap one, then the view controller from that tab bar is "invoked" and the new view appears immediately. That's like banging a door very hard, so that everyone in the neighbourhood can hear it. I would like to have a softer transition, ...

Is it against iPhone HIG to have several tab bar views in an app?

From what i've seen in iPhone applications, an application should only have one tab bar view that lets you select its major feature areas. Is it confusing or against HIG to do this for example: tap a tab, a table view gets displayed, select a cell, a new tab bar view gets loaded. ...

How to typecast an id to a concrete class dynamically at runtime?

Hi everyone, I have several dataSources I use for one UIViewController. My view controller uses KeyValue Observing in order to follow the state of certain properties at runtime. When I swap dataSources, I need to stop observing those properties. The problem is, I'm not sure of the class of the dataSource at runtime, therefor something l...

How can I set the background color of a cell in UITableView on iphone?

Hi, How can I set the background color of a cell in UITableView? Thanks. ...

Losing network connectivity on iPhone

I am developing a network application on iPhone that requires internet connection all the time. However, once I login to the server and keep the iPhone idle for a while, the iPhone goes to sleep mode and disconnects my network connection (it logs me out). If I run the same application on iPhone, while the iPhone is connected to the PC ...

How do I test if a string is empty in Objective C?

How do I test if an NSString is empty in Objective C? ...

How do i show image animation on iphone

I have a animated gif ( like this one ) , when I show in an image view on my iphone app it just shows the first frame . This behavior is consistent with the apple documentation . I was wondering what is the best way to achieve this on the iphone ? ...

How can I add CGPoint objects to an NSArray the easy way?

I have about 50 CGPoint objects that describe something like a "path", and I want to add them to an NSArray. It's going to be a method that will just return the corresponding CGPoint for an given index. I don't want to create 50 variables like p1 = ...; p2 = ..., and so on. Is there an easy way that would let me to define those points "i...

Iphone ringtone format

Hi, Does an Apple Lossless Audio Codec (alac) encoded m4a work as an IPhone ringtone? If not, what are the supported audio formats for IPhone ringtones? ...

Is there a way to put a scalar type like CGPoint (or any self created) into a NSArray?

Probably I could create a class that holds an CGPoint as instance variable, like a wrapper. Does that make sense? I feel uncomfortable with that, though. I hope there is an better solution. How about any self-created scalar type? Like MyCoolScalarType? ...

How can I programmatically determine if an "touchUpInside" event occured?

It seems like if this method will be called any time the user touches my view: - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; if ([touch view] == self && [touch tapCount] >= 1) { // do something... } } I've implemented this in an UIScrollView. The documentation...

UITableViewCell: How to prevent blue selection background w/o borking isSelected property?

I have a custom UITableViewCell subclass. I have set the contentView of my cell subclass to a custom UIView class in which i am overriding -drawRect: and doing all of the drawing there. Also, I am setting cell.contentView.opaque = NO in order to achieve transparency in certain areas of the cell (unfortunately, a backgroud image behind...

How can I programmatically determine CPU usage rate or how busy / occupied the system is in iPhone-OS?

My app is doing some pretty but heavy weight core animations during scrolling. Sometimes it crashes due to bad performance. So I need some way to find out if there is enough capability to make the animations, and if not, I just leave them away. Best way would be if I could ask the system how busy it is. UPDATE: I mean especially Core An...