UINavigationController
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
&tag(Objective-C, UIKit);
*目次 [#l3e91e9b]
#contents
*プログラムで追加する [#b8d44353]
-[[iOS: Xcode 4.2 and Navigation Controller - Stack Overf...
-[[iPhone Dev Tips: Navigation and Tap Bar Controller ...
-UINavigationControllerのインスタンスを忘れずreleaseする...
#pre{{
- (void)applicationDidFinishLaunching:(UIApplication *)ap...
{
navController=[[UINavigationController alloc] init];
MyViewController *firstController=[[MyViewController a...
[navController pushViewController:firstController anim...
[window addSubview navController.view];
}
- (void) dealloc
{
...
[navController release];
...
}
}}
*ボタンの追加 [#l6a47c0b]
**バーの右側に"+"ボタンを追加 [#bd62954c]
-self.navigationItem.rightBarButtonItemにUIBarButtonItem...
#pre{{
- (void)viewDidLoad {
[super viewDidLoad];
//"+"ボタンを生成
UIBarButtonItem *newButton = [[UIBarButtonItem alloc]...
//右側のボタンにセット
self.navigationItem.rightBarButtonItem = newButton;
// わすれずrelease。最初にautoreleaseしておくのでも良...
[newButton release];
}
}}
**バーの右側にアクションボタンを追加してアクションシート...
-アクションボタンを押す→UIActionSheetを表示→UIActionSheet...
#pre{{
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typic...
[self configureView];
UIBarButtonItem *actionButton = [[[UIBarButtonItem al...
initWithBarButtonSy...
target:self
action:@selector(ac...
self.navigationItem.rightBarButtonItem = actionButton;
}
- (void)actionPushed {
UIActionSheet *sheet = [[[UIActionSheet alloc] init] ...
sheet.delegate = self;
[sheet addButtonWithTitle:@"テスト1"];
[sheet addButtonWithTitle:@"テスト2"];
[sheet addButtonWithTitle:@"Cancel"];
sheet.cancelButtonIndex = 2;
[sheet showInView:self.view];
}
- (void)actionSheet:(UIActionSheet *)actionSheet clickedB...
if (buttonIndex == 0) {
NSLog(@"テスト1が押されました");
} else if (buttonIndex == 1) {
NSLog(@"テスト2が押されました");
}
}
}}
終了行:
&tag(Objective-C, UIKit);
*目次 [#l3e91e9b]
#contents
*プログラムで追加する [#b8d44353]
-[[iOS: Xcode 4.2 and Navigation Controller - Stack Overf...
-[[iPhone Dev Tips: Navigation and Tap Bar Controller ...
-UINavigationControllerのインスタンスを忘れずreleaseする...
#pre{{
- (void)applicationDidFinishLaunching:(UIApplication *)ap...
{
navController=[[UINavigationController alloc] init];
MyViewController *firstController=[[MyViewController a...
[navController pushViewController:firstController anim...
[window addSubview navController.view];
}
- (void) dealloc
{
...
[navController release];
...
}
}}
*ボタンの追加 [#l6a47c0b]
**バーの右側に"+"ボタンを追加 [#bd62954c]
-self.navigationItem.rightBarButtonItemにUIBarButtonItem...
#pre{{
- (void)viewDidLoad {
[super viewDidLoad];
//"+"ボタンを生成
UIBarButtonItem *newButton = [[UIBarButtonItem alloc]...
//右側のボタンにセット
self.navigationItem.rightBarButtonItem = newButton;
// わすれずrelease。最初にautoreleaseしておくのでも良...
[newButton release];
}
}}
**バーの右側にアクションボタンを追加してアクションシート...
-アクションボタンを押す→UIActionSheetを表示→UIActionSheet...
#pre{{
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typic...
[self configureView];
UIBarButtonItem *actionButton = [[[UIBarButtonItem al...
initWithBarButtonSy...
target:self
action:@selector(ac...
self.navigationItem.rightBarButtonItem = actionButton;
}
- (void)actionPushed {
UIActionSheet *sheet = [[[UIActionSheet alloc] init] ...
sheet.delegate = self;
[sheet addButtonWithTitle:@"テスト1"];
[sheet addButtonWithTitle:@"テスト2"];
[sheet addButtonWithTitle:@"Cancel"];
sheet.cancelButtonIndex = 2;
[sheet showInView:self.view];
}
- (void)actionSheet:(UIActionSheet *)actionSheet clickedB...
if (buttonIndex == 0) {
NSLog(@"テスト1が押されました");
} else if (buttonIndex == 1) {
NSLog(@"テスト2が押されました");
}
}
}}
ページ名: