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 […]
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 do I set recipients for UIActivityViewController in iOS 6?
I’m using the new UIActivityViewController class in iOS6 to provide the user with various sharing options. You can pass an array of parameters to it such as text, links and images and it does the rest. How do I define recipients? For example sharing via mail or SMS should be able to accept recipients but […]
How to use NSXMLParser to parse parent-child elements that have the same name
Does anyone have some idea how to parse the following xml using event-driven model NSXMLParser class? <Node> <name> Main </name> <Node> <name> Child 1 </name> </Node> <Node> <name> Child 2 </name> </Node> </Node> I want to collect all three names from this xml file, is it possible, or I have to change to Tree-based parsing?
Call the official *Settings* app from my app on iPhone
At one point in my app, I would like to redirect the user to the official Settings app. If possible, I also want go straight to the Network section within the Settings app. I think what I need is the Settings app’s url scheme and the format to construct my request. But I doubt that […]
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.)
How do I share an object between UIViewControllers on iPhone?
My application is a tab bar application, with a separate view controller for each tab. I have an object in my first view controller (A) which contains all my stored application data (Please ignore NSUserDefaults for this) which needs to be accessed by the second view controller (B) when I press a button on it. […]