2017-04-20 37 views
-2

你好,我需要所謂的堆棧設計方面的幫助,在Xcode中的XIB文檔中你有不同的層。堆棧設計中的不同層

+0

歡迎來到Stack Overflow。目前還不清楚你在問什麼,以及下面的答案如何解決你的問題。也許你應該先閱讀「[我如何問一個好問題?](https://stackoverflow.com/help/how-to-ask)」。 – andih

回答

-1

如果你把它放在viewDidLoad之下,它應該可以工作!

// Get the path 


NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); 
NSString *documentPath = [paths objectAtIndex:0]; 
NSString *path = [documentPath stringByAppendingPathComponent:@"highscore.save"]; 

// Create a dictionary to hold objects 
NSMutableDictionary* myDict = [[NSMutableDictionary alloc] init]; 

// Read objects back into dictionary 
myDict = [NSKeyedUnarchiver unarchiveObjectWithFile:path]; 
NSString *nssHighscore = [myDict objectForKey:@"Highscore"]; 
highscore = [nssHighscore intValue]; 


gameState = kStateMenu; 
ballVelocity = CGPointMake(0, 0); 
gravity = CGPointMake(0, kGravity); 
controlType = kTouch; 
+0

謝謝,它工作:) – Datakungen