A few subtle differences between UIKit and AppKit

If you cut your Objective-C teeth on the iPhone, like me, then you’ll run across these subtle differences between text fields and table views.

//** Text fields **/
//Mac OS X

NSString* someText = [someTextField stringValue];

//iPhone OS
NSString* someText = someTextField.text;

Table view data source delegate methods are different. On the iPhone, cell data is encapsulated in UITableViewCell and accessed by the framework by calling cellForRowAtIndexPath. On the Mac, cell data is accessed by the framework by calling objectValueForTableColumn. Note: This method is not required with Cocoa bindings.

/** Table view delegates **/

//Mac OS X 
-(id) tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row { /*...*/ }

//iPhone OS
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { /*...*/ }

Please share your notable differences.

Advertisements
A few subtle differences between UIKit and AppKit

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s