属性传值是从第一页传值到第二页。
一、属性传值第一步
在第二页的.h文件中
#warning 属性传值第一步
//用于接受从其他页面传过来的值
@property(nonatomic, retain)NSString *receiveString;
二、属性传值第二步
在第一页面跳转到第二页面的位置,给第二页面的属性赋值
- (void)buttonClicked:(UIButton *)button
{
SecondViewController *secondVC = [[SecondViewController alloc] init];
#warning 属性传值第二步
// 给第二个页面赋值
secondVC.receiveString = button.currentTitle;
[self.navigationController pushViewController:secondVC animated:YES];
[secondVC release];
}
三、属性传值第三步
在第二页中使用属性
#warning 属性传值第三步
// 使用属性
[button setTitle:self.receiveString forState:UIControlStateNormal];