UINavigationController 导航按钮组

 

#import <UIKit/UIKit.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) UINavigationController *navigationController;
@end
@implementation AppDelegate
@synthesize navigationController = _navigationController;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.
    self.window.backgroundColor = [UIColor whiteColor];
    RootViewController *rootVC = [[RootViewController alloc] init];
    _navigationController = [[UINavigationController alloc] initWithRootViewController:rootVC];
    [self.window addSubview:_navigationController.view];
    [self.window makeKeyAndVisible];
    return YES;
}

//跳转到新界面
ClassListViewController *classListVC = [[ClassListViewController alloc] init];
    [self.navigationController pushViewController:classListVC animated:YES];

//返回上一界面
[self.navigationController popViewControllerAnimated:YES];

 

//获取要返回的界面指针
UIViewController *vc = [self.navigationController.viewControllers objectAtIndex: ([self.navigationController.viewControllers count] -2)];

 

UINavigationController 导航栏导航按钮组

    //导航按钮一
    UIBarButtonItem *barButtonItem1 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemOrganize target:self action:@selector(select)];
    //导航按钮2
    UIBarButtonItem *barButtonItem2 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(add)];
    self.navigationItem.rightBarButtonItems = [NSArray arrayWithObjects:barButtonItem1,barButtonItem2, nil];

 

 

 

 

 

 

posted @ 2012-11-19 13:03  TQ.CH  阅读(259)  评论(0编辑  收藏  举报