Special

Clearance Sale!

We've been publishing for over five years now and it's time to clear out our inventory of back issues, so we're slashing prices!

RBD Magazines

Check out this amazing clearance sale of all our past issues. Missing some issues? This is a great time to complete your RBD collection. Save up to 40% off the regular price of our printed back issue packages. These prices are only good until the end of the year May 2008 and supplies are limited, so place your order today.

Article Preview


Buy Now

PDF:

Instant Cocoa

Article

Issue: 1.2 (October/November 2002)
Author: Colin Cornaby
Author Bio: Colin Cornaby is an OS X developer. Current projects include "Duality," a theme changer for Mac OS X, written in REALbasic.
Article Description: No description available.
Article Length (in bytes): 3,525
Starting Page Number: 43
RBD Number: 1122
Resource File(s): None
Related Web Link(s):

http://connect.apple.com/

Known Limitations: None

Excerpt of article text...

Now that you know what exactly Cocoa is, we'll get into coding Cocoa, and comparing it to REALbasic.

One of the first things you'll see is that Cocoa has different syntax. Cocoa still talks to objects, but it does so a bit differently. For example, let's pretend we have an object/method called roundPizzaPlace. We want to tell roundPizzaPlace to deliver a pizza. By the way, in Cocoa it is standard form to have the first letter in a Cocoa method/object lowercase, but have all the other words uppercase. roundPizzaPlace takes 3 arguments: the kind of pizza to be ordered, where it is to be delivered, and whether or not Cheesy Garlic Bread should be included with your order. I will show you how you would call the method in REALbasic, then Cocoa. In this case, the syntax for RB is:

roundPizzaPlace.orderPizza(typeofpizza, deliveryaddress, withbreadsticks)

REALbasic

roundPizzaPlace.orderPizza(CanadianBacon, 12345 1st Street, True)

Cocoa

[roundPizzaPlace orderPizza:CanadianBacon deliveryAddress:12345 1st Street withBreadSticks:YES];

...End of Excerpt. Please purchase the magazine to read the full article.

Article copyrighted by REALbasic Developer magazine. All rights reserved.


 


|

 


Weblog Commenting and Trackback by HaloScan.com