如何在 iPhone 上创建浮动在 tabbarcontroller 上方的图层

发布于 2024-08-21 23:43:15 字数 1404 浏览 4 评论 0原文

'大家好。

我在 iPhone 应用程序的结尾部分,发现我在应用程序的一个部分中,我想提供有关某些后台进程运行状态(位置管理器准确性)的反馈,并希望将其放在较低的位置屏幕左侧。这可以告诉用户我们对他们从我的应用程序收到的给定搜索结果的“确定”程度。

几个问题。这是一个基于导航的应用程序(只是让你知道)。我想在屏幕左下角的选项卡栏上方浮动一个(例如)40px 高、80(左右)像素宽的半透明黑色(可能是 alpha .6)圆角框。我希望能够使其根据需要出现(当位置管理器被调用时)并在我停止位置管理器时消失 - 但在应用程序的所有视图上浮动在应用程序上,并且在用户浏览应用程序时不会阻止触摸。这一切可能吗?如果是这样,怎么办?代码是最好的,但我不要求从头到尾的解决方案。

我只是没有“得到”以下内容:

  • 我不明白我是否可以始终将一个框浮动在应用程序的所有视图之上。
  • 从哪里开始......我用什么“对象”来构建它?卡拉层? CG矩形?我希望能够说(例如)“准确度:10”(并且让数字改变颜色...不知道这是否限制了我可以放置它的对象。
  • 不能阻止触摸。并且愿意使其在用户触摸屏幕并更改视图时保持浮动在应用程序上方。

这一切都可能吗?如果可以,有人可以给我一个很好的起点吗?我拥有获取位置管理器值所需的所有编程。 ..但不知道如何将视图放在其他视图之上而不将其他视图推离屏幕...或者类似的东西...它会阻塞并且是一个 AlertView ..不是我需要的项目:

// this is not the answer for what I need
baseAlert = [[[UIAlertView alloc] initWithTitle:@"One Moment" message:nil delegate:self cancelButtonTitle:nil otherButtonTitles: nil] autorelease];
[baseAlert show];
// Create and add the activity indicator
UIActivityIndicatorView *aiv = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
aiv.center = CGPointMake(baseAlert.bounds.size.width / 2.0f, baseAlert.bounds.size.height - 40.0f);
[aiv startAnimating];
[baseAlert addSubview:aiv];
[aiv release];

对我来说是完美的东西将是(我不知道是否可以做到)“返回通话”绿色样式状态栏,当您在 iPhone 状态栏下方通话时,苹果会显示该状态栏。我知道这对程序员来说是不可用的无论如何

,任何帮助将不胜感激。 提前谢谢。

'lo all.

I am in the ending portion of my app for the iPhone and found that I am in a section of the app where I want to give feedback about the status of some background process running (location manager accuracy) and want to place it in the lower left of the screen. This can tell a user how "sure" we are about the given search results they are receiving from my app.

Several issues. This is a navigation-based app (just so you know). I want to float a (for instance) 40px high, 80 (or so) pixel wide translucent black (maybe alpha .6) box with rounded corners at the bottom left of the screen above the tabbar. I want to be able to make it appear upon demand (when location manager gets called) and disappear when i stop location manager -- BUT float over the app on ALL VIEWS of the app and NOT block touches as the user navigates through the app. Is this all possible? And, if so, how? Code would be best but I am not asking for beginning to end solution.

I just do not "get" the following:

  • I do not understand if i can float a box above all views of an app at all times.
  • Where to start...what "object" do i use to build it? CALayer? CGRect? I want to be able to say (for instance) "Accuracy: 10" (and have the number change colors...dont know if that limits me to the object that I can put it on.
  • CANNOT block touches. and would LIKE to make it so it stays floating above the app when the user touches the screen and changes a view.

Is all this possible and if so, can someone give me a good starting point? I have all the programming necessary to GET the location manager values...but dont know how to put a view above the other views without pushing the others off the screen...OR something like this...which blocks and is an AlertView .. not the item i need:

// this is not the answer for what I need
baseAlert = [[[UIAlertView alloc] initWithTitle:@"One Moment" message:nil delegate:self cancelButtonTitle:nil otherButtonTitles: nil] autorelease];
[baseAlert show];
// Create and add the activity indicator
UIActivityIndicatorView *aiv = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
aiv.center = CGPointMake(baseAlert.bounds.size.width / 2.0f, baseAlert.bounds.size.height - 40.0f);
[aiv startAnimating];
[baseAlert addSubview:aiv];
[aiv release];

The perfect thing for me would be (and I do not know if it can be done) the "return to call" green style status bar that apple puts up when you are on a call underneath the iPhone status bar.. I know that is not available to programmers tho.

Anyway, any help would be appreciated.
Thx in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

魂ガ小子 2024-08-28 23:43:15

您应该能够创建一个 UIView 并将其作为子视图添加到主窗口中。

这会将其显示在您拥有的任何其他内容之上。然后,您可以使用 userInteractionEnabled 属性来禁用该视图的用户交互。

You should be able to create a UIView and add it to your main window as a subview.

That will display it on top of anything else you have. You can then use userInteractionEnabled property to disable user interaction of that view.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文