作者mew3133 (大雄)
看板MacDev
标题[问题] 两个View传值问题
时间Fri Jan 24 10:37:47 2014
请问一下我这样传值哪里有问题...QQ
我有两个View 简称View1 &View2
再View2 的StroyBoard ID 定义为“SystemView"
-----------------------------------------------
我在View1.h 宣告
@interface View1:UIViewCOntroller
@property (strong,nonatomic)View2 *view2;
@end
-----------------------------------------------
View2.h宣告一个变数
@interface View2 :UIViewController
@property int *number;
@end
-----------------------------------------------
View1.m 放入一个button 作为跳转
- (IBAction)SystemSegue:(id)sender {
self.view2.number=10;
NSLog(@"self SysViewcontrlloer is %@",slef.view2.number);
view2=[self.storyboard instantiateViewControllerWithIdentifier:@"SystemView"];
[self presentViewController:view2 animated:NO completion:nil];
}
可是在View1 NSLog有数值
进入View2 时..number 值却不见了...
我哪里做错了QQ?
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 60.251.182.37
1F:→ atst2:宣告为int * number? 然後用%@显示? 01/24 10:52
2F:→ atst2:改用@property (nonatomic, assign) int number试看看吧 01/24 10:52
3F:→ howdiun:错字好多..... 01/24 11:54