ITeye博客

IPhone 之 UINavigationController

fireflylover · 2011-12-26 23:14 · IPhone · 移动开发 · Markdown

1. 创建Navigation-based application 工程

2. RootViewController.h

    #import <UIKit/UIKit.h>

@interface RootViewController : UIViewController {
	
}

-(IBAction)englishClick:(id)sender;
@end

 

3. RootViewController.m

 

   #import "RootViewController.h"

#import "English.h"

@implementation RootViewController

- (void)viewDidLoad {
    [super viewDidLoad];
	self.title = @"足球资料";
}

-(IBAction)englishClick:(id)sender{
	English *e=[[English alloc]initWithNibName:@"English" bundle:nil];
	e.title = @"英超";
	[self.navigationController pushViewController:e animated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}

- (void)viewDidUnload {
}

- (void)dealloc {
    [super dealloc];
}

@end

 

4. 在RootViewController.xib中加入一个按钮,绑定englishClick事件。

 

 

 

5.创建新文件选 UIViewController subclass, 在English.xib中添加label控件

 

6.运行程序

 

  

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。