看板 MacDev 關於我們 聯絡資訊
請問一下我這樣傳值哪裡有問題...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
atst2:宣告為int * number? 然後用%@顯示? 01/24 10:52
atst2:改用@property (nonatomic, assign) int number試看看吧 01/24 10:52
howdiun:錯字好多..... 01/24 11:54