我基本上是在开发一个 iOS SDK,其他使用 Cocoa pod 的应用程序将使用它。我的问题是:
在主机应用程序的屏幕上覆盖纯文本,向他们显示重要的调试信息(当他们使用该应用程序时)可行吗?非常类似于游戏屏幕上的 fps 信息。如果是,建议?
一直在四处搜索,但我能找到的都是关于在相机、 map 和视频播放器上叠加的讨论,如下所示:
How do i overlay a text box over a native camera view in IOS
Is it possible to add a text overlay to videos?
Change text of label in ios camera overlay UIPickercontroller
Text overlay not showing in GPUImage iOS
在这方面的任何指导将不胜感激。
最佳答案
是的,应该是可行的,我会在窗口中添加一个“调试” subview 并设置 userInteractionEnabled = NO 这样 View 就不会消耗触摸。
像这样的事情应该让你开始:
#if DEBUG
UILabel *debugInfo = [[UILabel alloc] init];
debugInfo.text = @"some debug information here";
debugInfo.numberOfLines = 0;
[debugInfo sizeToFit];
debugInfo.userInteractionEnabled = NO;
[[[[UIApplication sharedApplication] delegate] window]addSubview:debugInfo];
#endif
关于ios - 在应用程序上覆盖文本以显示调试信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38426952/