-1

プログラムで UIView を作成しました。今、アニメーションをオンにしてビューを表示したいと思います。私のコードは以下です。コードはボタンクリックイベントにあることに注意してください。

 view1 = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 284)];
view1.backgroundColor = [UIColor redColor];
[self.view addSubview: view1];
UIButton *cancel = [UIButton buttonWithType:UIButtonTypeRoundedRect];
cancel.frame = CGRectMake(265, 0, 55, 20);
[cancel setTitle: @"Cancel" forState: UIControlStateNormal];
[cancel addTarget:self action:@selector(cancelView:) forControlEvents:UIControlEventTouchUpInside];
4

2 に答える 2

1

それを試してみてください....

 [UIView beginAnimations: nil context: nil];
 [UIView setAnimationBeginsFromCurrentState: YES];
 [UIView setAnimationDuration: 0.5];
 view1.frame = CGRectMake(20,45,110,548); //Set frame according your choice
 [UIView commitAnimations];

私が助けてくれることを願っています。

于 2013-07-24T11:46:10.340 に答える