-1

i have created an UIView programmatically. Now i want to disply the view with animation on. my code is below. Note that the code is on button click event.

 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 回答
0

将其用于带有动画的显示视图

https://github.com/kohtenko/KOPopupView

于 2013-07-24T11:29:59.250 回答