objective-c

Call back style

I am writing an iPhone application which in numerous places needs to perform non HTTP or FTP networking of a very simple request response type. I've wrapped all this up into a SimpleQuery class that integrates with the run loop. SimpleQuery *lookup = [[SimpleQuery alloc] init]; [lookup setDelegate:self]; [lookup doQueryToHost:querySer...

How do you make a Text Label display how many rows there are in the table.

I am using Core Data and want a Text Label to display how many rows there are in the table, what code would I need to enter in the class file's to do this? ...

Iphone UIButton not working

This is so damn simple im sure! Im missing something and im exhausted from trying to fix it. hopefully someone can help. The Button in CharacterView.m works but the button nested down in CharacterMale.m does not. I'm not using IB everything is done progmatically. CharacterView.m is being used as a container ///////////////////////////...

What does the property "Nonatomic" mean?

What does "nonatomic" mean in this code? @property(nonatomic, retain) UITextField *theUsersName; What is the difference between atomic and nonatomic? Thanks ...

How does an underscore in front of a variable in a cocoa objective-c class work?

I've seen in a few iPhone examples that attributes have used an underscore _ in front of the variable. Does anyone know what this means? or how it works? an interface file I'm using looks like: @interface MissionCell : UITableViewCell { Mission *_mission; UILabel *_missionName; } @property (nonatomic, retain) UILabel ...

How to create a horizontal scrolling view on iPhone???

I want to create a horizontal scrolling field at the top of a UITableView (something similar to what can be found on the Home section of the Facebook App). I want the scrolling field to be filled with six sections where only one section could be selected at a time? How should i do this? I know i should create a UIScrollView and set i...

Cocoa -/+ declarations

What's the difference between - and + when declaring with Cocoa/Obj-C. e.g. -(void)doSomething{} or +(void)doSomething{} ...

iPhone Memory Management and Releasing

Here's a common practice I see often (including from a very popular iPhone developer book) In the .h file: @interface SomeViewController : UIViewController { UIImageView *imgView; } Somewhere in the .m file: imgView = [[UIImageView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]]; [imgView setImage:[UIImage imageName...

How do I use C++ STL containers in My iPhone App?

I'd like to use an STL set in my iPhone app (which is written in Objective-C in XCode). How do I include set and/or use the standard namespace? In C++ I'd do this: #include<set> using namespace std; // use the set<T> somewhere down here... How can I do this in Objective-C? ...

How can I subclass CALayer to return a pre-styled layer?

How do you subclass CALayer so that you return a layer with styling properties already set? So that: MyCustomLayer *layer = [MyCustomLayer layer]; would create a layer with these properties; layer.backgroundColor = sweetBackgroundColor.CGColor; layer.borderColor = sweetBorderColor.CGColor; layer.borderWidth = 2.0; layer.cornerRadiu...

How to get IMEI on iPhone?

I want to get IMEI on iPhone. I try to use the following code: #import "Message/NetworkController.h" NetworkController *ntc=[[NetworkController sharedInstance] autorelease]; NSString *imeistring = [ntc IMEI]; But NetworkController is not found. I also find that I can get uniqueIdentifier using: UIDevice *myDevice = [UIDevice curr...

What Are Some Quirks/Surprises with Using .mm Files in Objective-C?

I want to use some C++ STL collections in my Objective-C iPhone app. Apparently this is possible by giving files the extension ".mm" . What are some of the quirks/surprises associated with this? I want to use the basic containers that I'm familiar with (vector, queue, set, ...) Cheers! ...

Objective-C cheat sheet

What cheat sheets exist for Objective-C? I have googled but I really don't know what to look for. Most of them assume I know Objective-C and I don't. I really want a guide aimed at an experienced programmer. ...

iPhone Can't deselect a UITableViewCell

I have a RootViewController class which is inherited from UITableViewController. When a cell is deselected by the user I want to enable/disable certain buttons on the toolbar. How do I trap the deselect event? -(void)tableView:(UITableView *)tableView deselectRowAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated { if(index...

Cocoa control for setting shorcuts

I want to build a preferences window for my Cocoa application. Is there a tutorial or example of how a control that sets shortcuts works? ...

Cocoa control for keywords/tags

I want to build a keyword/tag feature for my Cocoa application. Is there a tutorial or example of how a control that sets keywords/tags works? I want it to look something like the Keywords window in iPhoto that you get from Window->Show Keywords. ...

How do I save/export an OpenGL surface into Quicktime in Cocoa/Objective C?

i've modified the quartz composer slideshow sample from xcode to render a high speed slide show using a custom transition. The sample uses OpenGL (Cocoa) to render the slide show. I would like to export this slideshow into a video. Is there a way to use Cocoa/OpenGL to output this scene into a quicktime video? OR, should I just reimpl...

Determine if a path within an NSString is to a directory, or a file?

I have an NSString containing a path, but it could be either a file, or a directory. Is there an equivalent to the Python os.path.isdir() and os.path.isfile() methods in Cocoa? ...

Objective-C: Smalltalk-style Messages vs. C-style Functions

When should I use messages versus C-style functions? ...

Better performance with libxml2 or NSXMLParser on the iPhone?

Hi everyone, I'm curious what your solution is for high performance XML parsing on the iPhone is, given its limited amount of CPU power. I have reviewed the XML Performance App that Apple provides as a demonstration, and it seems that for the data feed (300 iTunes songs) that they're parsing.. libxml2 always seem to come as the forefron...