Objective-c 隐藏视图动画
您好,我的视图中有一个隐藏视图,通过单击按钮即可显示。但是,当您单击按钮时,我希望视图执行向上滑动动画,这样它不仅会出现,而且会向上滑动到其位置。
这是我的隐藏视图的代码: 在 .h 中:
@interface hidden_viewsViewController : UIViewController {
IBOutlet UIView *loginview;
}
@property (nonatomic, retain) IBOutlet UIView *loginview;
- (IBAction)login;
- (IBAction)logout;
在 .m 中
@synthesize loginview;
- (IBAction)login {
loginview.hidden = NO;
}
- (IBAction)logout {
loginview.hidden = YES;
}
- (void)viewDidLoad {
[super viewDidLoad];
loginview.hidden = YES;
}
Hello I have a hidden view inside of my view that appears by the click of a button. But when you click on the button I want the view to do an slide up animation so it won't just appear but slide up to it's position.
Here is the code for my hidden view:
in .h:
@interface hidden_viewsViewController : UIViewController {
IBOutlet UIView *loginview;
}
@property (nonatomic, retain) IBOutlet UIView *loginview;
- (IBAction)login;
- (IBAction)logout;
And in .m
@synthesize loginview;
- (IBAction)login {
loginview.hidden = NO;
}
- (IBAction)logout {
loginview.hidden = YES;
}
- (void)viewDidLoad {
[super viewDidLoad];
loginview.hidden = YES;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试一下,假设视图是纵向的:
Try, assuming the view is in portrait orientation:
您应该更改视图的框架属性,并且应该在动画块内执行此操作,如下所示:
希望它有帮助!
you should change the frame property of your view, and you should do it within an animations block, as follows:
Hope it helps!