Can't understand the meaning of this syntax...

I'm about two weeks into writing Cocoa, and about 1/3 of the way through Aaron Hillegass's book, which has been instrumental. I'm really starting to get the hand of things in Object-C, but I can't seem to grasp this syntax concept:
- (id) tableView:(NSTableView *)aTableView
objectValueForTableColumn:(NSTableColumn *)aTableColumn
row:(int)row;
This one is placed in my .h file, but I can't make sense of it. I think it stems from even the basics of something like this:
- (void)clearText:(id)sender
It's the stuff AFTER the semi colon that I don't quite understand. And the first example even takes it further! I just don't feel comfortable going, "Ehh, just type it in like the book says.". Can anyone put this into laymen's terms for me? Thanks for helping out a beginner. ^_^

First of all, the brackets are took off because it's used to create an external link...
However you can use { code } markups (without spaces in it) like that :
{ code }
// your code
{ code }
gives without spaces inside the braces :
// your code
Now let's get back to your code... Everything you said is not really true, so I'm going to correct a few thing, and also correct your code a little...
ejtrowbridge wrote:
Alright, I've done some more brainstorming, and I might have answered my own question. If someone could just verify (or modify!) my reasoning, I'm set!
So here's some example code:
- (void)setPersonName:(NSString *)aName
aName = [aName copy];
[personName release];
personName = aName;
*The Breakdown:*
- The method name is "setPersonName".
- setPersonName is not returning anything.
- setPersonName is allowing the variable "aName" to be modified which is strict typed to a NSString.
- The instance variable personName is cleared of any previous value.
- The instance variable personName is given the same value of "aName" that was passed into the method.
Is that right? Let me try one more to see if I got it:
Okay so your breakdown has some errors :
- the name of the method is not "setPersonName" but really "setPersonName:" the colons are part of the name, and it's better to remember it.
- setPersonName: takes one argument of type "NSString *" (which is indeed strictly typed) and named "aName".
The correct code for that function is :
- (void)setPersonName:(NSString *)aName
[personName release];
personName = [aName copy];
Okay some precisions, we call that method a setter, it's a specific kind of method, the name generally starts with the word "set" followed by the instance variable name that it modify with its start letter in capital, it returns "void" and takes one argument which is the new value of the instance variable and so it's the same type.
ejtrowbridge wrote:
*Example code:*
- (float)expectedRaise
return expectedRaise;
- (void)setExpectedRaise:(float)x
expectedRaise = x;
*The Breakdown:*
- The method expectedRaise will be returning a float value.
- Then it returns whatever expectedRaise's float value is.
- The method setExpectedRaise will not be returning anything.
- Will accept outside changes to the variable "x" which is strict typed to a float value.
- Then the method sets the instance variable expectedRaise to the value of "x" which was passed in from outside.
Here everything is good, accessor methods for non-object instance variable are pretty simple.
ejtrowbridge wrote:
Is this how I should be interpreting accessor methods? If this is right, then I will feel more comfortable moving forward in the book. This seems like it is used ALOT, so I wanted to make sure I was headed in the right direction. If it is, the only questions is where the "aName" and "x" values come into play... but maybe I'm getting ahead of myself.
So yes, it's how you should. And yes it's used a lot, that's a basis of Object-Oriented Programming. We encapsulate the values of our classes, they're not accessible from the outside, so we use accessor methods to allow the users to touch it BUT under our control, if you want to modify the accessor methods to make a specific behavior you can, for example, let say you a percentage in a class and you don't want it to be superior to 100, you can write that :
- (void)setPercent:(int)aValue
if(aValue > 100)
aValue = 100;
percent = aValue;
With that code you're sure that percent will never be over 100. So with the accessor methods you keep the control of your instance variable and avoid the user to corrupt the object datas.

Similar Messages

  • My macbook air will not connect to the internet due to a self assigned IP address. I have tried trawling the support forums, but either I can't understand the suggestions, or they don't work. Please explain to me in simplest terms how to fix this. Thanks!

    My macbook air will not connect to the internet due to a self assigned IP address. I have tried trawling the support forums for hours, but either I can't understand the suggestions, or they don't work. Please explain to me in simplest terms how I can fix this. Many thanks!

    The warranty entitles you to complimentary phone support for the first 90 days of ownership.
    If you bought the product in the U.S. directly from Apple (not from a reseller), you have 14 days from the date of delivery in which to exchange or return it for a refund. In other countries, the return policy may be different. If you bought from a reseller, its return policy applies.

  • What is the meaning of this column in the pricing  procedure?

    Dear Gurus,
    What is the meaning of this column in the pricing procedure?
    thanks..

    subtotal field : Subtotal field is used to pass the value to some other field in PO .
    for ex: using value 9 you pass the value to field komp-brtwr. so that this can be used in  any other routine in the pricing procedure.
    requirement field: if there is a scenario that condition type should come in pricing on some condition like vendor country is india. in that case use create the requirment and attached this requirement.in this requirment you put logic and set the sy-subrc value 4 or 0.

  • I bought yesterday online an Iphone from apple store Canada and there said that was Unlocked but on my email came a message " IPHONE 4S BLACK 16GB GSM- CAN". Does It means that this item is Unlocked?

    I bought yesterday online an Iphone from apple store Canada (http://store.apple.com/ca/browse/home/shop_iphone/family/iphone/iphone4s) and there said that was Unlocked but on my email came a message " IPHONE 4S BLACK 16GB GSM- CAN". Does It means that this item is Unlocked?
    Was shipped today, October 8, but I don't know if this "GSM-CAN" means taht is locked or unlocked!
    I BOUGHT AN UNLOCKED! 

    "GSM-CAN" means that it was a GSM iPhone sold in Canada. It doesn't indicate anything regarding lock status. If you purchased the iPhone from the online Apple Store, then to the best of my knowledge, they don't sell anything other than unlocked iPhones.
    Regards.

  • Can anyone clarify the meaning of Cruise Ship data?

    Can anyone clarify the meaning of Cruise Ship data?  I recently asked for it on my account, but when I returned from my cruise I was charged all sorts of Global Roaming data charges.  No Cruise Ship usage was listed on my bill even though I only used it while at sea (tethering my PC).
    The rep I spoke with said that the billing codes used for Cruise Ship Data and Global Data are the same, and Global Data was how it was listed on my bill. What would the distinction be, then?  I assumed that Cruise Ship data would use the cruise ship's towers, but it appears that you have to worry about what country you are sailing near while at sea and whether they subscribe.  Anyone have any light to shed on this?
    Thanks!
    P.S. The service is even slower than what the cruise ship offers for $.55/minute, and the connection is not reliable. I will not be using this feature again, and cannot in good conscience recommend it.

        Thanks so much for asking, Rayray_10803. I would be happy to clarify roaming charges.
    Wireless Cruise Ship Service allows Verizon Wireless  customers to make and receive voice calls while at sea using their own mobile phone and mobile telephone number.
    This service exists on various cruise lines, through an agreement with Wireless Maritime Services (WMS), Maritime Communications Partners (MCP) and Sea Mobile to offer an advanced network on board various cruise ships for Verizon Wireless.
    For this reason, rates on cruise ships are different than they are when you visit the country without using the towers on the ship.
    Check cruise ship rates vs. international rates here vzw.com/tripplanner.
    TamaraH_VZW
    Follow us on Twitter @VZWSupport

  • How can I improve the performace of this?

    I have two tables - TableA and TableB. TableB is having 500,000,000 rows. I need to insert these rows, after some processing on them, into tableA. My insert statement is like this -
    Insert into tableA
    select A,B,C,...
    from TableB
    How can I improve the performace of this?
    Here it will select 500,000,000 rows from TableB and store the result in cache and then start inserting.
    Do I have any way so that the select statement starts releasing the records (and not wait upto 500,000,000 record ) and in parallel insert statement start inserting the records?

    Shirish,
    You need to insert more than 500 millions of rows in a table, right ?
    But one point can be a problem, this is when you said "I need to insert these rows, after some processing on them". What does that means after some processing ?
    Please give us more information about all your process, maybe the problem doesn't come from the insert itself ?
    And why the APPEND hint cannot be an answer ?
    And why create table cannot be an answer ?
    What time did you expected for insert of these 500 millions of rows ?
    Nicolas.

  • I can't put numbers on the decimals. It only allow ,00 as decimals. If i put 33.00 it's ok but i i put 33.44 when i press enter changes to 3344 as an entire number, i've try everything and can't find the solution. This should be a basic thing.

    I can't put numbers on the decimals. It only allow ,00 as decimals. If i put 33.00 it's ok but if i put 33.44 when i press enter changes to 3344 as an entire number, i've try everything and i can't find the solution. This should be a basic thing. How frustrating !!

    pedrofromsydney wrote:
    €          55,555.00
    that's the result i get. Still why can't i just type for ex. 29.55 and stay like that on the cell ? Why does it always change to 2955 or 2955.00. ??
    I don't understand this
    It appears you have the cell formatted to Currency, with the default two decimal places.
    What I don't understand, though is how Numbers arrived at a result of fifty five thousand five hundred fifty five on your entering the exact keystrokes in Yvan's post:
    an equals sign, followed by five ones, followed by a forward slash, followed by a 2.
    Here's the result I get:
    Could you do the following:
    Open a NEW Numbers document using the Blank template.
    Drag the Row and Column control (bottom right corner) to reduce the table to two columns and three rows.
    Enter the words "My table" in cell A1.
    Click on cell B2 to select it, then enter the formula 
    =11111/5
    Use only those eight keystrokes; do not include any commas, periods or other characters not shown.
    Click on B2 again to select it.
    Open the inspector and choose the Cell Format button.
    Do not make any changes in the Inspector window.
    Drag the Inspector window to the position shown in my screen shot.
    Take a screen shot that includes the Formula bar, the Table (with cell B2 selected) and the Cell Format Inspector pane (the same screen area as in my screen shot above).
    Post the screen shot in a reply to this post.
    I'm hoping there will be some clues as to what's happening here in the screen shot. Procedure for taking and posting a shot of part of the screen follows.
    Regards,
    Barry
    SCREEN SHOTS (Selected area)
    Place the mouse pointer at the top left corner of the area you want to include.
    Press shift-command-4.
    The mouse pointer will change to a plus sign on a circle.
    Hold down the mouse button and drag to the bottom right corner of the area you wan to capture.
    Release the mouse button.
    The screen shot will be saved to your desktop with the name "Picture 1" (The number will be different if you have taken other screen shots).
    POSTING
    In the Compose frame, place the Insertion point at the location you want the picture to be inserted.
    Click the camera icon above the compose frame to open the Insert Image dialogue.
    Click Choose file to open the Choose dialogue.
    If necessary, navigate to the Desktop and click on the 'by date column header to sort the files by date, most recent at the top.
    Select the most recent picture file.
    Click Choose.
    Wait for the picture's file name to appear beside Choose file.
    Click insert image.
    Done.
    B.

  • MM - PO - what is the meaning of this button?

    Dear friends,
    Could anybody help me with one question.
    There is a strange button in a Purchasing Order on the Account Assignment tab page on this screenshot (it is marked with red color).
    Screenshot below
    http://content.foto.mail.ru/mail/raiden87/81/i-84.jpg
    What is the meaning of this button? When it is used for?
    I hope that anybody knows the meaning =)

    hi raiden,
    as for as i have gone through the issue I have come to know that:
    If you want to use multiple account assignment for a line item in PO then at that moment you will have to first press the "repeat on " button. only after that multiple account button will be active that is just before your "repeat on " button.
    Steps:
    1:Save your PO.
    2:Go to transaction code ME22N to change the PO.
    (Here you will firstly see that the multiple a/c assignment button is firsty gray.It will become active only after when you press the "repeat on" button).
    I hope It will be helpfull for you.
    regards,
    Aslam Ansari.

  • So I have an iPad with the smart cover, and it's usually supposed to turn on the iPad when u open it, but it's no doing that for me. Nor is it turning off without pressing the button. What is the meaning of this?

    So I have an iPad with the smart cover, and it's usually supposed to turn on and off the iPad when u open it and close it, but it's not turning on for me. Nor is it turning off without pressing the button. What is the meaning of this?what caused it to be this way? Is there someway that I could fix it?

    Wait a sec did this just start?
    You set up the smart cover function in settings (you did that, right?) so, if you did that and it's failed you make an appointment at your nearest Genius Bar now.

  • When I click "about this mac" to check on my storage, I get a number of different sections music, movies, etc. but also I get a section called backups, where can I find the files in this section?

    When I click "about this mac" to check on my storage, I get a number of different sections music, movies, etc. but also I get a section called backups, where can I find the files in this section?

    Welcome to Apple Support Communities
    All the storage in "Backups" is taken up by local snapshots, which are made automatically in all MacBooks, MacBooks Pro and MacBooks Air with OS X Lion or newer and Time Machine turned on.
    See > http://pondini.org/TM/30.html I recommend you to leave them there, because they will be removed automatically. However, if you want, you can disable or remove them manually if you want, even if there's no reason to do this. Have a look at the link above for more information

  • I have a Mac Pro OS 10.7.5 and have a DVD+R disc with files on it, but it ejects the disk after about 10 seconds--what to do?  How can I get the data off this disc?  I can see it has been already burned, so files are on there?

    I have a Mac Pro OS 10.7.5 and have a DVD+R disc with files on it, but it ejects the disk after about 10 seconds--what to do?  How can I get the data off this disc?  I can see it has been already burned, so files are on there?

    Try cleaning the lens and see if that will restore functionality to the DVD drive.  Use a DVD lens cleaning disk, if you have a can of compressed air, shoot some into the slot or wrap a fine microfiber cloth (eyeglasses cleaning cloth)  around a business card and insert it gently inside the slot.
    If no success, make an appointment at an Apple store genius bar and get a free diagnosis from them.
    Ciao.

  • I HAVE TO INSTAL A PRODUCT C LLED "KUDANI AIR " . FAILURE TO DO SO IS BASED ON  ADOBE AIR , SO I AM TOLD . HOW CAN I MAKE SURE THAT IS THE CASE ?? HOW CAN I SOLVE THE PROBLEM IF THIS IS THE CASE ??

    I HAVE TO INSTALL A PRODUCT CALLED "KUDANI AIR " . FAILURE TO DO SO IS BASED ON  ADOBE AIR , SO I AM TOLD . HOW CAN I MAKE SURE THAT IS THE CASE ?? HOW CAN I SOLVE THE PROBLEM IF THIS IS THE CASE ??

    if you try to install an app that depends on adobe air, you should be prompted to download and install adobe air (unless it's already installed).
    you can download and install directly so you're not prompted by that app, Adobe - Adobe AIR

  • Please help!! "Can't open the illustration. This artwork contains a very large image that can not...

    Hi all, I am subscribing Illustrator CS6 16.0.0 and using it on Windows 7.
    Few days ago I was working with one file, I saved it successfully and now when I'm trying to open it an error message occures "Can't open the illustration. This artwork contains a very large image that can not be read on this version of AI. Please try with 64-bit version." and ALMOST ALL of the objects (vector) are missing as if they were deleted!
    It's kind of strange since I created the file with the same program and everything was working properly before.
    Please Please advice further steps for recovering my file.

    Thank you so much! the file is recovered (as well as my emotional state )
    The finding of the day - apparently I have two versions of AI in my PC!

  • I am a student who subscribed to the 9.99 photography package, I didn't realize there was a discount for students.  I would like to upgrade to the full package with the student discount.  I can not find the option for this. How do I do this?

    I am a student who subscribed to the 9.99 photography package, I didn't realize there was a discount for students.  I would like to upgrade to the full package with the student discount.  I can not find the option for this. How do I do this?

    Hi Djmontanalv,
    Please go through the link below.
    http://helpx.adobe.com/x-productkb/policy-pricing/cancel-membership-subscription.html
    Regards,
    Anand

  • One of my imported MOV files turns "black" after editing with it for a time and I can't retrieve the images. This has happened three times, only this file. The placeholder is still there. Files are fine on hard drive. What gives? how to stop this?

    One of my imported MOV files turns "black" after editing with it for a time and I can't retrieve the images. This has happened three times, only this file. The placeholder is still there. Files are fine on hard drive. What gives? how to stop this? is in final cut pro 10.1.4

Maybe you are looking for