私は、iPhoneとiPad用に別々に2つのアプリデリゲートを持つユニバーサルアプリケーションを実行しています。のようなyesに設定されたbool値BOOL isiPhone
とメソッドを使用して、単一のアプリデリゲートでデバイスをチェックできますか+(AppDelegate*)instance;
?次に、どうすればさまざまなビューを起動できますか?このようなコードスニペットを取得しました
@interface AppDelegate : NSObject <UIApplicationDelegate, NSFetchedResultsControllerDelegate> {
UIWindow* window;
BOOL isiPhone;
@property (nonatomic, retain) IBOutlet UIWindow* window;
@property (nonatomic, assign) BOOL isiPhone;
+ (AppDelegate*)instance;
@end
そして、アプリケーションのApp Delegate mファイル:
@synthesize m_ForIPhone;
self.MapVC = [[MapViewController alloc] initWithNibName:(self.isiPhone ? @"MapView" : @"MapView@pad") bundle:nil];
self.DetailVC = [[DetailViewController alloc] initWithNibName:self.isiPhone ? @"DetailView" : @"DetailView@pad" bundle:nil];
self.AboutVC = [[AboutViewController alloc] initWithNibName:self.isiPhone ? @"AboutView" : @"AboutView@pad" bundle:nil];