View Full Version : Some newbie syntax questions
gizzerd91
Jul 16, 2009, 01:09 PM
Why is it that IBAction functions have a semicolon in them right before the curly brackets, while all other functions I am aware of do not?
- (IBAction)click: (id)sender;
{
Why does the asterisk, which I assume is for declaring a the new variable "application", come inside of the parenthesize?
- (void)applicationDidFinishLaunching: (UIApplication *)application {
PhoneyDeveloper
Jul 16, 2009, 02:01 PM
Why is it that IBAction functions have a semicolon in them right before the curly brackets, while all other functions I am aware of do not?
It is an oddity of Objective-C syntax that placement of a semicolon before the curly brace is optional. There's nothing special regarding IBActions in this regard; it's the case for all methods.
Why does the asterisk, which I assume is for declaring a the new variable "application", come inside of the parenthesize? (UIApplication *)
The star indicates that this is a pointer. You read pointer expressions like this from right to left. Pointer to UIApplication object. You need to read more about this in a book about C and then one about Objective-C. In the line of code that you show the pointer expression is the type of the parameter named application.
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.