2012-12-14 18 views
0

我是编程新手,我研究了一下Xcode(版本4.2)。还有,如果你选择,例如一个新的单一视图的应用程序,它会创建一个方法correspondind viewController.m文件,如:Xcode 4.5在创建新类时并未在viewController.m中创建一些方法

-(void)viewDidUnload 
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 

等。 但现在我已经下载的Xcode 4.5,创造了一个新的一个新的单一视图的应用程序,并在相应的viewController.m文件只有3种方法:

-(void)viewDidLoad 
-(void)didReceiveMemoryWarning 
-(void)dealloc 

,这一切。如何在创建新的viewController.m文件时自动添加所有这些方法?

回答

1

这些方法不会被添加,因为它们在iOS6中已被弃用。而不是使用- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation,你应该重写这些:

- (NSUInteger)supportedInterfaceOrientations-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation

和关于viewDidLoad中 - 视图不再低内存情况下清除,因此该方法不会被调用

+0

谢谢。您能否给我一个关于方法中特定更改的链接,以及我现在应该使用哪些方法而不是它? – diman4eg