【发布时间】:2011-07-27 10:51:58
【问题描述】:
我正在创建一个 iphone 应用程序,其中我的 oneviewcontroller 中有一些整数值,我希望在我的 secondviewcontroller 控制器中使用该整数值。
值将是随机的。 我将这个整数值存储在 id score
Nw 我正在使用此代码,但我无法获取整数值。
代码:passing integer value from one UIView to another UIview
整数值在第二个视图控制器处始终为零。
任何帮助将不胜感激。
谢谢。
我的密码:
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 : 我编辑了我的代码.. 请看一下..
-
@Shrey : 好的.. 我试过了,但我希望 SecondView 中的值.. 在 secondview 中,值变为 0(零).. 任何帮助..!!:o