objective-c

How do you use the different Number Types in Objective C

So I am trying to do a few things with numbers in Objective C and realize there is a plethora of options, and i am just bewildered as to which type to use for my app. so here are the types. NSNumber (which is a class) NSDecmial (which is a struct) NSDecimalNumber (which is a class) float/double (which are primitive types) so e...

Override Interface Builder instantiation of objects?

I'm developing for the iPhone, and I have a class DataManager, that is used to maintain my application data. When the application launches/exits, the data is read from/written to disk to create an instance of this class, using the NSKeyedArchiver (and Unarchiver) classes, since the DataManager adheres to the NSCoding protocol. One probl...

Problem with UIActivityIndicatorView on iPhone

I want to show UIActivityIndicatorView on my iphone when it changing the view. I have written the following code: - (void)viewDidLoad { spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]; [spinner setCenter:CGPointMake(320/2.0, 460/2.0)]; // I do this because I'm in la...

How to determine an invalid CFSocket

Hi Everyone, how can I avoid, to send data via CFSocketSendData to an invalid socket? I've try to determine the socket state with CFSockerIsValid, but this method returns still true when the other side is close. So how can I determine if the socket is valid? In order so avoid Errors. Thank Chris ...

Best way to stream MP3 from an iPhone app?

I am working on an application that will stream music from a server of mine from an iPhone application. This is my first iPhone app so I am a bit confused : What would be the best way to do this? Is there something already built in that I could use, like a MP3 player that I just need to point toward the correct server? Do I need a s...

Where to look at when it comes to iPhone documentation?

I am starting to get into iPhone development, and I find it very hard to get documentation. Where can I find a complete API, tutorials, forums and so on? I know that apple released some tutorials, are they helpful? Is there some kind of "iPhone dev 101" post somewhere that I should absolutely read? Anything will help. ...

How to link to the iTunes store from iPhone app?

Hi, I am trying to set up an application in which users will be able to stream music. When the user is streaming a MP3, I'd like to set up a link to the iTunes store to buy the MP3. How can I do that? I feel like there should be some simple way of doing so using the song title and artist name, am I mistaking? Thanks ...

Idiomatic, classy, open-source examples of Cocoa Interfaces?

Greetings, I'm currently learning Cocoa and Objective-C. I've run through "all" the tutorials and I'm fairly comfortable with the ObjC language. What I'm looking for now is to learn Cocoa idioms and see real code used in nice-looking Cocoa apps. It seems like serious apps (iTunes, etc.) don't just drop in the IB elements. They do a lot...

CFAttributedString on the iPhone

Hi, Is it possible to use the CFAttributedString type to draw formatted text on the iPhone? I see it in the documentation, but I can't figure out how to actually draw it to a context. Thanks, Kyle ...

How would you make a Button display a Menu when clicked?

I am looking for some code to make a Menu appear next to a button when it is clicked. What code would I need for this? Sorry if this sounds a bit vague. ...

Is it possible to add an item to the right-click context menu of a Mac OS programmatically?

I have a program that works with a variety of files on both the Windows and Mac OS. I would like to give the user the option of adding a new option to their right click/control click context menu to the effect of "Compress with [Name of App]". I know this is quite possible in Windows with modifications to the registry, but is there a w...

Ball to Ball Collision - Gains significant velocity upon collision

I implemented the code from the question "Ball to Ball Collision - Detection and Handling" in Objective-C. However, whenever the balls collide at an angle their velocity increases dramatically. All of the vector math is done using cocos2d-iphone, with the header CGPointExtension.h. What is the cause of this undesired acceleration? The f...

Uploading a file over HTTP/HTTPS and/or FTP/FTPS on a Mac

I have found numerous examples on uploading a file to a web server via C++ on Windows. However I am struggling after a lot of searching (and I thought I was good with Google!) to find any examples to help me achieve the same on a Mac. Can anyone point me towards some help on how to upload a file to a web server on a Mac OS using either...

How do I test if a primitive in Objective-C is nil?

I'm doing a check in an iPhone application - int var; if (var != nil) It works, but in X-Code this is generating a warning "comparison between pointer and integer." How do I fix it? I come from the Java world, where I'm pretty sure the above statement would fail on compliation. ...

Objective-C release of singletons

Hi, Im pretty new to objective-c programming and releasing of objects is my greatest headache. I'm always doubting on what need to be released, and my times I've end up releasing the wrong variable and getting a BAD EXEC crash. I've read apple's guide on memory management, but I cant always go from their examples to my code. One of the...

Submitting a link via iPhone -> Facebook Connect

I'm trying to post links through the iphone facebook connect without using the feed control.. I want to simulate how the publish a story works on facebooks website, where i pass a link, and it returns back an image, story title, and a link. Right now I only know how to use the feed control, but I'm thinking there has to be a way to use p...

Can I make Textmate completions ignore capitalisation?

I've used Textmate for a couple of years, but for objective-c I'm finding that Xcode is easier. One of the reasons I like Xcode is that I can type "nsui" and it will suggest NSUInteger for me. If I want the same thing in Textmate, I have to type "NSUI" since the start of the suggestion I want is all capitalised. Textmate won't match the ...

Accessing Google APIs from iPhone native app

I'd like to access some Google API's from within an iPhone native app. I'm not a web programmer and have never used AJAX, but I'm guessing I need some kind of bridge between Objective-C and Javascript. Ideally I'd just fire XML at Google and process the result. I really have no idea were to start. Has anyone successfully done this, or...

selector keyword

-(void)clicketbutton{ UIButton *mybutton = [UIButton buttonWithType:UIButtonTypeCustom]; [mybutton setTitle:@"Click here" forState:UIControlStateNormal]; [mybutton addTarget:self action:@selector(displayvalue:)forControlEvents:UIControlEventTouchUpInside]; } -(void)displayvalue:(id)sender{ UIButton *resultebutton= [UIButton buttonWithT...

next-previous with large number of views

I am trying to manage 18 different views. How can I handle next-previous functionality for each view in an efficient way with this many views? ...