随笔分类 -  Programming iOS 4

O'Reilly - Programming iOS 4 May 2011
p062blocks
摘要:#import "BlocksAppDelegate.h"@implementation BlocksAppDelegate@synthesize window=_window;- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ NSArray* arr = [NSArray arrayWithObjects: @"Manny", @"Moe", @"Jack 阅读全文

posted @ 2011-09-09 11:16 upwifi 阅读(103) 评论(0) 推荐(0)

p060functionPointer
摘要:#import "FunctionPointerAppDelegate.h"@implementation FunctionPointerAppDelegate@synthesize window=_window;NSInteger sortByLastCharacter(id string1, id string2, void* context) { NSString* s1 = (NSString*) string1; NSString* s2 = (NSString*) string2; NSString* string1end = [s1 substringFrom 阅读全文

posted @ 2011-09-07 15:03 upwifi 阅读(112) 评论(0) 推荐(0)

p029static
摘要:#include <stdio.h>// just proving that static variables actually workint myfunction() { static int result = 0; // 0 means we haven't done the calculation yet if (result == 0) { result = 100; // pretend this is an expensive calculation printf("\n\nCalculating result for the first and o 阅读全文

posted @ 2011-09-06 23:01 upwifi 阅读(96) 评论(0) 推荐(0)

p021function
摘要:#include <stdio.h>/* demonstrating how a function is declared, called, and defined *//* In the book I don't go into the fact that you can't have a function inside a functionBut you can't, and since the call to square is inside main,the definition of square must be outside main*//* 阅读全文

posted @ 2011-09-04 22:01 upwifi 阅读(112) 评论(0) 推荐(0)

p017forloop
摘要:#include <stdio.h>int main (int argc, const char * argv[]){ /* Demonstrating a for loop Notice that the counting variable defined in the scope of the for loop is confined to the for loop Feel free to play around with the code and try out other forms of flow control */ printf("\n"); i 阅读全文

posted @ 2011-09-01 23:37 upwifi 阅读(108) 评论(0) 推荐(0)

p011Pointers
摘要:#include <stdio.h>int main (int argc, const char * argv[]){ /* This is to demonstrate the point that a value mutated thru one pointer affects that value as seen by any other pointers to the same value I can't really demonstrate this using only the syntax discussed up thru page 11 but I wan 阅读全文

posted @ 2011-08-31 22:27 upwifi 阅读(130) 评论(0) 推荐(0)

O'Reilly - Programming iOS 4 May 2011 + 0day原版
摘要: 阅读全文

posted @ 2011-08-31 22:15 upwifi 阅读(132) 评论(0) 推荐(0)

导航