Difference between revisions of "Objective-C Sandbox"
From Wikicliki
(→Traces) |
|||
Line 26: | Line 26: | ||
</pre> | </pre> | ||
− | Syntax | + | * Syntax: MyNotes is the class: |
<pre> | <pre> | ||
Line 34: | Line 34: | ||
// pass multiple arguments | // pass multiple arguments | ||
[notesObj createNewNoteWithTItle:@"First Note" andDescription:@"I Love ObjectiveC"]; | [notesObj createNewNoteWithTItle:@"First Note" andDescription:@"I Love ObjectiveC"]; | ||
+ | </pre> | ||
+ | |||
+ | * Instructor is trying to say these are two methods. | ||
+ | <pre> | ||
+ | @interface Movie : NSObject | ||
+ | -(void)playMovie:(NSString *)movieName; | ||
+ | -(void)getMovieRatingForMovie:(NSString *)movieNamethatHasAnActor:(NSString *)actorName; | ||
+ | @end | ||
</pre> | </pre> |
Revision as of 03:50, 2 March 2013
A haphazardly conducted class
Hello World
- Open Xcode
- You'll see templates - select single view
- Create new "Hello World" - check local git if you want versioning - select a folder and you will have created the project
- Uncheck storyboards, uncheck include unit tests, select universal
- Check out the views button on top right hand corner
- Nav on left, editor in center, utility on right, debug at bottom
- Uncheck Autolayout:
- Select some tiny box (3rd on bottom row), drag a label to the panel, click on top row 4th button to see the label editing options, type hello world, and then press run.
- Published a hello world screen in the simulator
Traces
inside viewcontroller.m
NSLog(@"trace"); NSDate *dateObj = [[NSDate alloc] init]; NSLog(@"date is %@", dateObj);
- Syntax: MyNotes is the class:
MyNotes *notesObj = [[MyNotes alloc] init]; // pass single argument [notesObj createNewNoteWithTItle:@"First Note"]; // pass multiple arguments [notesObj createNewNoteWithTItle:@"First Note" andDescription:@"I Love ObjectiveC"];
- Instructor is trying to say these are two methods.
@interface Movie : NSObject -(void)playMovie:(NSString *)movieName; -(void)getMovieRatingForMovie:(NSString *)movieNamethatHasAnActor:(NSString *)actorName; @end