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

本文详细介绍了如何创建一个基于导航的应用程序,并通过RootViewController实现基本功能,包括设置视图标题、按钮点击事件以及页面跳转。
7807

被折叠的 条评论
为什么被折叠?



