我正在制作一个动画,在其中我必须将一个UIView
名为“ subView ”的高度设为 0。现在 subView 包含一个UIButton
和UIImageView
。现在我通过这种方法在按钮单击时将高度设为 0
@interface ViewController : UIViewController
{
IBOutlet UIView *suvView;
IBOutlet UIButton *subButton;
IBOutlet UIImageView *imgview;
}
-(IBAction)hide:(id)sender;
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
[self.view addSubview:suvView];
[suvView addSubview:subButton];
[suvView addSubview:imgview];
}
-(IBAction)hide:(id)sender
{
[UIView beginAnimations:nil context:suvView];
[UIView setAnimationDuration:0.25];
[suvView setFrame:CGRectMake(0, 94, 320, 0)];
[UIView commitAnimations];
}
@end
但是当我将高度设置为 0 时,名为“subButton”和“imgview”的视图看起来就是这样。我想让它们在子视图高度为 0 时隐藏。
我正在使用 XCode 4.5