我有两个 ViewController:RedButtonViewController 和 TweetViewController。RedButtonViewController 在 Textlabels 中生成随机数,我想将数字或标签与 TweetViewController 一起使用。我怎样才能做到这一点?
谢谢你的帮助!
我的 TweetViewController 将在 RedButtonViewController 中使用以下代码打开:
- (IBAction)TweetViewController:(id)sender {
TweetViewController *Tweet = [[TweetViewController alloc] initWithNibName:nil bundle:nil];
[self presentModalViewController:Tweet animated:YES];
}
这是我如何生成随机数的示例:
- (IBAction)pushRedButton:(UIButton *)sender {
int ZahlDerToten;
ZahlDerToten = arc4random() % 1000000;
outputLabel.text = [NSString stringWithFormat:@"You killed %d people.", ZahlDerToten];