我想在Xcode中創建一個應用程序,當手機從一個方向旋轉到另一個。Xcode的幫助 - 類'secondview'的錯誤實現+'-switchview:'的方法定義'找不到
這裏是 「switchviewcontroller.h」 文件代碼:
#import <UIKit/UIKit.h>
@interface SwitchViewController : UIViewController {
}
-(IBAction)switchview:(id)sender;
@end
-----------------------------------------------------------------
And here is the "switchviewcontroller.m" file code:
----------------------------------------
#import "SwitchViewController.h"
#import "secondview.h"
@implementation SwitchViewController
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return YES;
}
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{
if((fromInterfaceOrientation == UIInterfaceOrientationLandscapeLeft) ||
(fromInterfaceOrientation == UIInterfaceOrientationLandscapeRight))
{
[[secondview alloc] initWithNibName:@"secondview" bundle:[NSBundle mainBundle]];
}
}
我得到了2個警告的問題表明,它也不起作用。
確定這樣的代碼是顯示不正確,在所有 – Baccalad 2011-01-21 16:24:42
感謝使它看起來正確的ennuikiller – Baccalad 2011-01-21 16:28:13