In this code:
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
{
UILabel *labelsText;
}
@property(strong, nonatomic) IBOutlet UILabel *labelsText;
-(IBAction) clicked: (id) sender;
@end
1.
The line with @property..
As I understood it was @property(blabla) datatype variable
But the code has 3 stuff?
IBoutlet, UIlabel and *labelsText
2.
The function clicked will change the labels content depending on which button was pressed, as both buttons are connected to that functions.
But it returns an IBAction? The code to change the labels text is in the function, it never returns anything? Could it as easily be -(void) instead?
When defining a property .. you don’t need to declare it as a member variable..
so
is not required…
IBActionis exactly likevoidexcept it is special way to communicate to you that this function is attached to a component in xib filesedit : // update /..correction ..thanks to BJ Homer
property are the easy way to generate setter and getter methods for your variables and objects..
so instead of maybe 10 lines of code..
you can too it in only 4 lines…