我正在創建一個iphone應用程序,其中我的oneviewcontroller中有一些整數值,我希望在我的secondviewcontroller控制器中使用整數值。想要將整數值傳遞到另一個視圖
值將是隨機的。 我存儲這個整數值在id分數
Nw我正在使用此代碼,但我無法獲得整數值。
CODE:passing integer value from one UIView to another UIview
整數值總是在secondviewcontroller變爲零。
任何幫助將不勝感激。
謝謝。
我的代碼:
FirstView.h文件
NSInteger myScore;
id score;
NSInteger totalscore;
.m文件
NSInteger *cal = (myScore * 100)/400 ;
totalscore = cal;
score = totalscore;
SecondView.h文件
int scorevalue ;
SecondView.m文件
FirstViewController *firstVC = [[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil];
value = firstVC.Score;
NSLog(@"SCORE : %d" ,value);
你能顯示你的代碼嗎? – Sascha
@Sascha:我編輯了我的代碼..請看看.. – iUser
@Shrey:好的..我試過這個,但我想在SecondView ..中的值,並在第二次查看值變成0(零)..任何幫助。 !!:o – iUser