objective-c

What's the best way to show the user something is loading on the iPhone?

Recently I've been looking to create some way of showing a user that something is being loaded. I'm sure anyone with an iPhone has seen this is apps before but what is the best way of doing it? I started using UIProgressHUD, however it was pointed out to me that you shouldn't really use private (undocumented) API's. I then I moved onto...

Closing child windows in Cocoa when the main window is closed

I'm a Cocoa newbie so it is likely that my approach is wrong but .. I have an app which opens several child windows (after the main/parent window has been loaded) using NSWindowController and InitNibWIthName. This works fine. But when I close the parent window (using the red x) these remain open and prevent the app from closing until t...

Should I always use accessors for instance variables in Objective-C?

If I have a class with some IBOutlets, it seems kind of silly to create accessors for these. But then I feel like I'm breaking OO practices by not always going through the accessors for instance variables. I also feel the same way about some instance variables that should not be public, I'd rather not expose the inner workings of some ...

how to create an xml using objective-C with respect to data storage?

Hello, I want to save user generated data in an XML file in the iphone. While we have NSXMLParser to parse through any xml from a url, do we have any method to create a xml file which can be stored in the app documents directory, so that i can use the parser to read the file and then display the contents back in the app. Or using Core ...

NSMutableArray, alloc or capacity?

Is there any reason to go with either of these, other than one returning an autoreleased object and the other needing a manual release? NSMutableDictionary *drink = [[NSMutableDictionary alloc] init]; // do things ... [drink release]; OR NSMutableDictionary *drink = [NSMutableDictionary dictionaryWithCapacity:10]; gary ...

Drawing vector graphics on iphone

Please forgive the newbie question. I have an iphone game that currently uses lots of png images for animations. While this works well, the images are taking up alot of memory. I have the images in a vector format as well and I would prefer to use those instead of the pngs. Is there a native way to do that? ...

Accessing an Array of Dictionarys?

I have a couple of questions regarding the code below: (1) Is "newItem" an autoreleased object? Its getting a returned dictionary from the specified array index? (2) Is there a simple way to access an array of dictionarys in one hit, or am I doing it the way you would expect? #import <Foundation/Foundation.h> int main (int argc, cons...

Get the current working directory of process with a pid programmatically on OS X

Is there a way to get the current working directory of a process using it's PID programmatically on OS X? Cocoa, Carbon, or AppleScript are all acceptable. It is not acceptable to send "pwd" to the current terminal window/tab (Do not want to affect the workspace). The linux command "pwdx" also is also unacceptable (just in case you re...

Defining categories for protocols in Objective-C?

In Objective-C, I can add methods to existing classes with a category, e.g. @interface NSString (MyCategory) - (BOOL) startsWith: (NSString*) prefix; @end Is it also possible to do this with protocols, i.e. if there was a NSString protocol, something like: @interface <NSString> (MyCategory) - (BOOL) startsWith: (NSString*) prefix; @e...

Cocoa: pasting formatted text in the current font?

When I put formatted text into the pasteboard (NSRTFPboardType), it pastes with all formatting preserved. But what I'd really like is to discard the font face and size information, while preserving the weight, color, etc. According to the docs, an NSAttributedString with no font information will default to Helvetica 12, so that seems l...

How long would it take me to learn Objective C programming having no prior programming experience?

I have no programming experience but would like to get into iPhone App development. Should I learn a programming language or outsource? I have time. ...

NSLog with PlugIn development for Coda

I've just started and am attempting to write plug-ins for Coda. Now, I can't for the life of me i can't figure out how or where NSLog's get outputted for debugging. When the plugin is loaded by Coda, it works fine. So my question is: 1) for the quick and dirty, should I be using NSLog w/ an app plugin? 2) what happens everytime I cal...

How do I know if a pointer is an NSObject?

I have a pointer in an objective-C class that I need to send messages to. The pointer can potentially be anything, so I need to make sure that it will respond to my messages before I send them. Here's the function I'm using to do the checking: int delegatePreparedForSelector(id delegate, SEL aSelector) { if (delegate && [deleg...

Need help with IOSurface & OpenGL for max os x snow leopard application

Apple added the new IOSurface framework as part of the 10.6 Mac OS X firm update. Since this framework relatively new, I haven't found the much need documentation on how to properly use this. I was wondering if there anyone on StackOverflow that can assist me with IOSurface usage. Anyways, this is what I want to do. Right now my applic...

[NSLocale currentLocale] always returns "en_US" not user's current language

I'm in the processes of internationalizing an iPhone app - I need to make programmatic changes to certain views based on what the user's current locale is. I'm going nuts because no matter what the language preference on the iPhone simulator or actual hardware are, locale always evaluates to "en_US": NSString *locale = [[NSLocale curre...

Is there a way to mix MonoTouch and Objective-C?

I'd like to know if there is a way to mix C# and Obj-C code in one project. Specifically, I'd like to use Cocos2D for my UI in Obj-C and call some MonoTouch C#-Library that does some computations and get some values back. Is there a way to do this? Or maybe the other way around, i. e. building in MonoTouch and calling Cocos2D-functions? ...

Blue dot and circle when finding current location

Does anyone know how I can animate the blue circle / dot like google maps when you find your current location? I saw this in a differnt iphone application and was wondering how to programatically create that animation and look and feel using the iPhone SDK 3.0? Can anyone shed some light on this? Sample code would be great. ...

Secure Remote Password Implementation for iPhone

I've been reading about Stanford's Secure Remote Password protocol, and it looks ideal for the sort of environment in which iPhone apps run. Unfortunately, I haven't been able to find a good Objective-C implementation of the protocol. Nor, as far as I can tell, do the crypto libraries in the SDK implement it. Does anyone know of such an...

Google Search Engine - Cocoa

Hey all, Would it be possible to make a google search engine in Xcode, cocoa? If so, how? I want the user to type in a phrase in a textfield called inputBox, and the button to be sendButton. When the button is pressed it will open your default browser to the searched phrase. Thanks, KeViN ...

How does one interact with OBJ-based 3D models on iPhone?

I have a few different OBJ files that I am able to parse and display. This code is based on Jeff LaMarche's The Start of a WaveFront OBJ File Loader Class. However, I need some means of detecting what coordinates I have selected within a displayed model. Usually there is one model displayed at a time but sometimes there will be two or mo...