Tag: cocoa touch

Is there a way to remove the separator line from a UITableView?

I’m looking for a way to completely remove the separator line in a UITableView when in the plain mode. This is done automatically in grouped, but this also changes the dimensions of the table in a way that is hard to measure. I have set the seperator line color to colorClear. But this does not […]

NSArray Equivalent of Map

Given an NSArray of NSDictionary objects (containing similar objects and keys) is it possible to write perform a map to an array of specified key? For example, in Ruby it can be done with: array.map(&:name)

With ARC, what's better: alloc or autorelease initializers?

Is it better (faster & more efficient) to use alloc or autorelease initializers. E.g.: – (NSString *)hello:(NSString *)name { return [[NSString alloc] initWithFormat:@”Hello, %@”, name]; } OR – (NSString *)hello:(NSString *)name { return [NSString stringWithFormat:@”Hello, %@”, name]; // return [@”Hello, ” stringByAppendingString:name]; // even simpler } I know that in most cases, performance here shouldn’t […]

How to write a simple Ping method in Cocoa/Objective-C

I need to write a simple ping method in Cocoa/Objective-C. It also needs to work on the iPhone. I found an example that uses icmp, will this work on the iPhone? I’m leaning towards a solution using NSNetServices, is this a good idea? The method only needs to ping a few times and return the […]

How to give space between two cells in tableview?

I want a space between two cell in table view, I want cell like this, How can i do that?

IPhone/IPad: How to get screen width programmatically?

Hi I’m wondering if there’s a way to get the width programmatically. I’m looking for something general enough to accomodate iphone 3gs, iphone 4, ipad. Also, the width should change based on if the device is portrait or landscape (for ipad). Anybody know how to do this?? I’ve been looking for a while… thanks!

How to use single storyboard uiviewcontroller for multiple subclass

Let say I have a storyboard that contains UINavigationController as initial view controller. Its root view controller is subclass of UITableViewController, which is BasicViewController. It has IBAction which is connected to right navigation button of the navigation bar From there I would like to use the storyboard as a template for other views without having […]

Alternatives to dispatch_get_current_queue() for completion blocks in iOS 6?

I have a method that accepts a block and a completion block. The first block should run in the background, while the completion block should run in whatever queue the method was called. For the latter I always used dispatch_get_current_queue(), but it seems like it’s deprecated in iOS 6 or higher. What should I use […]

What is – good for?

In my question “How do I get -[NSString sizeWithFont:forWidth:lineBreakMode:] to work?”, I learned that -[NSString sizeWithFont:constrainedToSize:lineBreakMode:] was actually what I needed. The documentation for -[NSString sizeWithFont:forWidth:lineBreakMode:] states explains it doesn’t actually wrap the text to additional lines. So how would I use it? (Examples would help.)

Can I access the keychain on the iPhone?

This question discusses encrypting data on the iPhone using the crypt() function. As an alternative, is there a keychain on the iPhone and if so, what code would I use to access it in order to store login details and then retrieve them for us in an application?