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.运行程序