【发布时间】:2012-10-05 05:15:18
【问题描述】:
我正在制作一个动画,在其中我必须将一个名为“subView”的UIView 的高度设为0。
现在该子视图包含一个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”的视图看起来是这样的。 我想在 subView 高度为 0 时隐藏它们。
我正在使用 XCode 4.5
【问题讨论】:
标签: iphone ios xcode ios4 ios6