ユーザ用ツール

サイト用ツール


ios

文書の過去の版を表示しています。


iOS開発

iPhone、iPadアプリの開発

UIViewControllerの切り替え

複数のUIViewControllerを使いたい場合は、UIApplicationDelegate に切り替えコードを実装。

HogeAppDelegate.h

@interface HogeAppDelegate : NSObject <UIApplicationDelegate>
 
@property (nonatomic, retain) IBOutlet UIWindow *window;
 
- (void) useFugaViewController;
 
@end

HogeAppDelegate.m

- (void) useFugaViewController
{
    FugaViewController *controller = [[FugaViewController alloc]initWithNibName:@"HogeViewController" bundle:NULL];
 
    self.window.rootViewController = controller;
 
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:0.75];
    [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:controller.view cache:YES];
    [UIView commitAnimations]; 
 
    [controller release];
}

UIViewControllerから呼び出す

-(void)onTouchDownChangeUIViewController:(id)sender
{
    HogeAppDelegate* delegate = (HogeAppDelegate *)[[UIApplication sharedApplication]delegate];
    [delegate useFugaViewController];
}
ios.1315408163.txt.gz · 最終更新: 2011/09/07 15:09 by nullpon