1

I am basically developing an iOS SDK which will be used by other apps using Cocoa pods. My question is:

Is it feasible to overlay plain text on the screens of the host app, showing them important debug information(as they use the app)? pretty much like the fps information on games screens. If yes, suggestions?

Have been searching around but all I can find are discussions around overlaying on Camera, Map and Video player, like the following:

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

Any guidance in this respect would be appreciated.

Community
  • 1
  • 1
Frost_Mourne
  • 149
  • 10

1 Answers1

1

Yes, should be feasible, I would add a "debug" subview to the window and set the userInteractionEnabled = NO so that view does not consume touches.

Something like this should get you started:

 #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
PakitoV
  • 2,476
  • 25
  • 34
  • That is one way to do it but I am looking for a solution that can be overlayed on my SDK's host app screens(which can be of any format). Also, if the view can stay independent of the navigation they make in the app? – Frost_Mourne Sep 01 '16 at 03:07
  • Frost_Mourne: I think it covers both requirements you mention, you can call that from your SDK without any knowledge of the hosting application as the last line is common to all apps, and that view will be in top of all views independent of the navigation without messing with the user interaction... adding that subview at the level of window will act as the overlay you need and no need to code anything on the hosting app... – PakitoV Sep 01 '16 at 09:02
  • 1
    Indeed it does! Thanks for the solution. – Frost_Mourne Sep 05 '16 at 03:55