Special

Special Print Closeout!

We're clearing out the remainder of our print issues at fire sale prices -- as much as 75% off! Quantities are extremely limited and only available while supplies last. Hurry to take advantage of this one-time offer.

RBD Magazines

Once these printed back issues are gone, they are gone!

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