Hi,
I am currently studying the class of programming in iPhone from stanford. I saw the instructor was trying to program a calculator.
First, he created a label to display the digits. He dragged it from the UI view to the code to establish the connection.
He dragged he label to 'ViewController.h' creating a new '@property'.
But, when he was trying to create the digit button. He just dragged the button directly to 'ViewController.m' but not .h. Creating only a method like below,
Here are my questions,
1. If the label is just a property, what is the class? The entire view?
2. Does '@property' have the same meaning of "member" in c++?
3. Why does the button not being a property but just a simple method in the implementation file.
4. And in c++, we need to announce the method first in the header file, then we specify the action of that method in the implementation file. But it seems in this program he didn't announce that "digitPressed", but simply in the .m file. why.
5. It said when the digit being pressed, it will send a string pointer. Could anyone tell me who it is sending to?
THank you so much for you help and please forgive that I am a starter in this field.
I am currently studying the class of programming in iPhone from stanford. I saw the instructor was trying to program a calculator.
First, he created a label to display the digits. He dragged it from the UI view to the code to establish the connection.
He dragged he label to 'ViewController.h' creating a new '@property'.
But, when he was trying to create the digit button. He just dragged the button directly to 'ViewController.m' but not .h. Creating only a method like below,
Code:
- (IBAction) digitPressed : (UIButton *) sender
{
NSString *digit = [sender currentTittle];
}
Here are my questions,
1. If the label is just a property, what is the class? The entire view?
2. Does '@property' have the same meaning of "member" in c++?
3. Why does the button not being a property but just a simple method in the implementation file.
4. And in c++, we need to announce the method first in the header file, then we specify the action of that method in the implementation file. But it seems in this program he didn't announce that "digitPressed", but simply in the .m file. why.
5. It said when the digit being pressed, it will send a string pointer. Could anyone tell me who it is sending to?
THank you so much for you help and please forgive that I am a starter in this field.
Last edited by a moderator: