Navigationはよく使われています.
3588 ワード
グローバル設定
self.navigationController.navigationBar.translucent = NO;// Bar , YES 64
// navigation
[[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0, -60)forBarMetrics:UIBarMetricsDefault];
//
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) {
[[UINavigationBar appearance] setBarTintColor:[UIColor whiteColor]];
[[UINavigationBar appearance] setTintColor:[UIColor blackColor]];
}
else {
[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
}
[[UINavigationBar appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys: [UIColor blackColor], NSForegroundColorAttributeName, [UIFont boldSystemFontOfSize:18], NSFontAttributeName, nil]];
[[UINavigationBar appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor blackColor], NSForegroundColorAttributeName,[UIFont fontWithName:@"Helvetica" size:(18)],NSFontAttributeName,nil]];
システム標準ボタン//
UIBarButtonItem *addMember = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(addMember)];
self.navigationItem.rightBarButtonItem = addMember;
//
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@" " style:UIBarButtonItemStylePlain target:self action:@selector(doClickSubmitAction)];
カスタムパターンself.navigationItem.rightBarButtonItem=[[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"album_add_photo"] style:UIBarButtonItemStylePlain target:self action:@selector(onAddAlbumButtonClicked)];
ユーザー定義のテキストUIButton* backButton= [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 44, 44)];
[backButton setTitle:@"Submit" forState:UIControlStateNormal];
backButton.titleLabel.font=[UIFont systemFontOfSize:13];
[backButton addTarget:self action:@selector(doClickSubmitAction)forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem * leftBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:backButton];
Item色を設定しますself.navigationItem.rightBarButtonItem.tintColor = [UIColor blackColor];
title Viewを設定しますUIButton *navButton = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 200, 44)];
[navButton setBackgroundColor:[UIColor blackColor]];
[navButton setTitle:@"Discover" forState:UIControlStateNormal];
[navButton addTarget:self action:@selector(_actionlocat:) forControlEvents:UIControlEventTouchUpInside];
self.navigationItem.titleView = navButton;
簡単なカスタムアニメーション[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:0.75];
[self.navigationController pushViewController:view animated:NO];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.navigationController.view cache:NO];
[UIView commitAnimations];
多重層に戻る vc ( index )
[self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:2] animated:YES];
[self.navigationController popToViewController: [self.navigationController.viewControllers objectAtIndex:self.navigationController.viewControllers.count-2] animated:YES];
( class )
for (UIViewController *controller in self.navigationController.viewControllers) {
if ([controller isKindOfClass:[ Controller class]]) { [self.navigationController popToViewController:controller animated:YES]; }
}
Itemアイコンサイズ設計基準