Iphone用UINavigationController实现在两个页之间导航(上)(5)
来源:未知 责任编辑:责任编辑 发表时间:2013-11-17 14:39 点击:次
@property (copy) NSString *city; //创建一个属性set/get方法
@end
//CityDetailViewController.h原代码结束
//CityDetailViewController.m原代码开始
#import "CityDetailViewController.h"
@implementation CityDetailViewController //实现控制器类
@synthesize city; //属性city变量
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
cityName.text = city;//获取从前一个页面传来的数据
//创建一个系统添加按钮,按下后,调用视图控制器上的add方法
UIBarButtonItem *rightButton = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemAdd
target:self action:@selector(add:)];// 调用视图控制器上的add方法
//设置为导航控制器控制条上的右边按钮
self.navigationItem.rightBarButtonItem = rightButton;
[rightButton release];
[super viewDidLoad];
}
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)dealloc {
[super dealloc];
}
@end
//CityDetailViewController.m原代码结束
相关新闻>>
- 发表评论
-
- 最新评论 更多>>