像 Xcode 那种 “Build Succeeded” 提示怎么实现呢?

2012-07-20 20:15:53 +08:00
 chenluois
如图:


提示出现几秒后能够自动消失,这个怎么实现呢?
4505 次点击
所在节点    iDev
8 条回复
Kymair
2012-07-20 20:48:51 +08:00
xatest
2012-07-20 20:59:06 +08:00
这种View叫做HUD(Heads Up Display),一般用于显示当前状态。
https://github.com/samvermette/SVProgressHUD
https://github.com/jdg/MBProgressHUD
chenluois
2012-07-20 21:03:01 +08:00
@Kymair 这个光有个形,怎么让它比如出现 2 秒后自动消失呢?
@xatest 这两个都是 iOS 的啊,有 Mac 上的例子吗?

谢谢!
elden
2012-07-20 21:07:14 +08:00
@chenluois [self retain]; 两秒后再release
froo
2012-07-20 21:12:16 +08:00
chenluois
2012-07-20 22:12:05 +08:00
谢谢各位!自动消失用 NSTimer 实现了。
BenX
2012-07-21 00:16:32 +08:00
- (void)hideViewAnimated:(BOOL)animated {
[self.timer invalidate];

if (animated) {
[UIView beginAnimations:nil context:nil];
[UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(hideViewDidStop:finished:context:)];

self.alpha = 0.0;

[UIView commitAnimations];
} else {
self.alpha = 0.0f;
self.hidden = YES;

[self removeFromSuperview];
}
}
dingtianran
2012-07-21 23:46:32 +08:00
Xcode这个提示是好像是来自notification center,似乎不是自己实现的

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/42995

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX