在iPhone4SDK中,如何获取TransitionCurlUp以触发随机文本?

在iPhone4SDK中,如何获取TransitionCurlUp以触发随机文本?,iphone,animation,random,page-curl,Iphone,Animation,Random,Page Curl,我正在尝试组合一个应用程序,它有一组文本,当用户按下按钮翻页时,这些文本可以随机化。基本上,按下按钮做两件事;翻转页面并将文本更改为随机包含的短语 我正试图通过将页面卷曲到同一个XIB文件中并更改文本来实现这一点。页面卷曲可以工作,但不会更改文本。不知道我做错了什么 这是我的密码: @implementation InfoViewController @synthesize isViewPushed; // Implement viewDidLoad to do additional s

我正在尝试组合一个应用程序,它有一组文本,当用户按下按钮翻页时,这些文本可以随机化。基本上,按下按钮做两件事;翻转页面并将文本更改为随机包含的短语

我正试图通过将页面卷曲到同一个XIB文件中并更改文本来实现这一点。页面卷曲可以工作,但不会更改文本。不知道我做错了什么

这是我的密码:

@implementation InfoViewController

@synthesize isViewPushed;


 // Implement viewDidLoad to do additional setup after loading the view.
- (void)viewDidLoad {


if(isViewPushed == NO) {

 { UIButton * btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
 btn.frame = CGRectMake(200, 300, 100, 50);
 [btn setTitle:@"Next" forState:UIControlStateNormal];
 [btn addTarget:self action:@selector(cancel_Clicked:)     forControlEvents:UIControlEventTouchUpInside];
  [self.view addSubview:btn];
}

{ UIButton * btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
 btn.frame = CGRectMake(20, 300, 100, 50);
[btn setTitle:@"Previous" forState:UIControlStateNormal];
[btn addTarget:self action:@selector(next_clicked:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:btn];
}

int  text = rand() % 5;
switch (text) {
 case 0:
 textview.text = @"Hello 1" ;
 break;
case 1:
textview.text = @"Hello 2" ;
break;
case 2:
textview.text = @"Hello 3" ;
break;
case 3:
textview.text = @"Hello 4" ;
break;
case 4:
textview.text = @"Hello 5" ;
break;

}
}
}


-(void) cancel_Clicked:(id)sender {

[self.navigationController dismissModalViewControllerAnimated:YES];

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self.view cache:YES];

[UIView commitAnimations];
}

-(void) next_clicked:(id)sender {


 [UIView beginAnimations:nil context:NULL];
 [UIView setAnimationDuration:1.0];
 [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view  cache:YES];
 [UIView commitAnimations];
}

任何帮助都太好了。

我看不出您在哪里设置文本值:

[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view  cache:YES];

...set or update text value here....

 [UIView commitAnimations];
或之后

[UIView commitAnimations];

...set or update text value here....

如果您正确格式化代码,可能会有所帮助。。。