Home
Blog
Browse
Login
Sign Up Free
Objective C
[{"left":"Sending Messages
","right":"Syntax:
\n\n[code][object message][/code]\n\nSample Code:\n\n[code]\n\nNSArray _foods = @[@\"tacos\", @\"burgers\"];_
\n\nNSString result = [foods description];
\n\nNSLog(@\"%@\", result);
\n\n[/code]
\n\nOutput:\n\n[code]challenge[3]: (\n\ntacos, burgers)[/code]
"},{"left":"Special case of NSUInteger
","right":"As you can see below NSUInteger (unsigned long) doesn't need an * (aesterisk)
[code]NSString city = @\"Ice World\";\n\nNSUInteger cityLength = [city length];
NSLog(@\"City has %lu characters\", cityLength);[/code]
\n\n
"},{"left":"Operations on NSNumbers
","right":"[code]NSNumber *higgiesAge = @6;
NSNumber *phoneLives = @3;
NSUInteger higgiesAgeInteger = [higgiesAge unsignedIntegerValue];
NSUInteger phoneLivesInteger = [phoneLives unsignedIntegerValue];
NSUInteger product = higgiesAgeInteger_ phoneLivesInteger;
NSLog(@\"Higgie is actually %@ years old.\", product);
[/code]
\n\nNSNumbers can't be multiplied using normal asterisk.
\n\n
"},{"left":"String Concatenation
","right":"[code]
NSString firstName = @\"Rajan\";
NSString lastName = @\"Chandi\";
NSString *fullName = [[firstName stringByAppendingString:@\" \"] stringByAppendingString: lastName];
NSLog(@\"%@\", fullName);
[/code]
\n\nSimple **+** sign won't work here.
\n\nIf there is a colon (**:**) - it expects an argument.
\n\n
"},{"left":"Summary","right":"Replace this text with summary of the note."}]
Basics 2
Added by
Rajan Chandi
846 views
Share :
Export PDF
Fold*
Play
*Use Arrow Keys
Sign Up Free
Classmint lets anyone create annotatable, audible and beautiful study notes for free.
×
Share this Note Privately
Type in names of people below:
Type in names of group(s) below: