页面之间传值,常见的几种方式。
2015-01-08 18:49
267 查看
ViewController页面传到TwoViewController页面name的值:两个页面都拥有一个字符串对象,跳转之前,把对象传过去。
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@property (nonatomic,copy)NSString *name;
@end
- (void)viewDidLoad {
[super viewDidLoad];
self.name = @"ranki";
TwoViewController *two = [[TwoViewController alloc]init];
two.name = self.name;
// [self.navigationController pushViewController:two animated:YES];
[self presentModalViewController:two animated:YES];
}
@interface TwoViewController : UIViewController
@property (nonatomic,copy)NSString *name;
@end
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
NSLog(@"~~~~~~~~~~~~~~~~~~~~~~~%@",self.name);
}
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@property (nonatomic,copy)NSString *name;
@end
- (void)viewDidLoad {
[super viewDidLoad];
self.name = @"ranki";
TwoViewController *two = [[TwoViewController alloc]init];
two.name = self.name;
// [self.navigationController pushViewController:two animated:YES];
[self presentModalViewController:two animated:YES];
}
@interface TwoViewController : UIViewController
@property (nonatomic,copy)NSString *name;
@end
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
NSLog(@"~~~~~~~~~~~~~~~~~~~~~~~%@",self.name);
}
相关文章推荐
- PHP在不同页面之间传值的三种常见方式
- ASP.NET 页面之间传值的几种方式
- PHP在不同页面之间传值的三种常见方式
- .NET页面之间传值的几种方式总结
- asp.net中页面之间小数据量传值的几种方式
- ASP.NET 页面之间传值的几种方式
- 【ASP.NET MVC系列】浅谈ASP.NET 页面之间传值的几种方式
- MVC中的页面传值,通常指Controller和view之间的数据传递,经常用到的有几种方式,总结如下:
- ASP.NET 页面之间传值的几种方式
- 详解ASP.NET 页面之间传值的几种方式
- 详解ASP.NET 页面之间传值的几种方式
- 关于html页面之间传值的几种方式
- ASP.NET 页面之间传值的几种方式
- 浅谈ASP.NET 页面之间传值的几种方式
- ASP.NET 页面之间传值的几种方式
- [转] PHP在不同页面之间传值的三种常见方式
- ASP.NET页面之间传值的几种方式
- 页面之间传值的几种方式
- ASP.NET页面之间传递值的几种方式
- JS控制的几种页面跳转方式和传值