Overlay text on the application to show debug information - ios

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.

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

Related

Is there a way to invert the colors in a PDFView?

I'm displaying PDF files in an iOS / Mac Catalyst app with PDFView. My app has had a dark color theme since long before Apple added Dark Mode to its operating systems, but now that Apple supports this, I'm thinking it should be possible to display the PDFView with a Dark Mode (inverted colors, with white text on a dark background) to match the rest of the app. However, I haven't found a way. Here's what I've tried:
PDFView *pdfView = [[PDFView alloc] init];
pdfView.overrideUserInterfaceStyle = UIUserInterfaceStyleDark; // no effect
pdfView.tintColor = [UIColor blackColor]; // no effect; also tried whiteColor
I found the PDFAppearanceCharacteristics class, and that offers a way to change the PDF background color, but I'd need to change the text and any shape objects, too. (I'm not worried about photos in PDFs, because that doesn't typically occur with my app.) I also checked the PDFDocument and PDFPage classes, but they don't seem to offer anything like this.
I was kind of hoping this would just follow the operating system's Dark Mode automatically, but I'm surprised there's not at least some way to override the colors. Is there an option I'm missing?

How to get uiimagepicker Spinner button action in iOS?

I'm using below code.
self.picker=[[UIImagePickerController alloc] init];
self.picker.delegate=self;
self.picker.allowsEditing=NO;
self.picker.sourceType=UIImagePickerControllerSourceTypeCamera;
self.picker.cameraOverlayView=[self addCameraRollButton];
[self presentViewController:self.picker animated:NO completion:NULL];
How to take picture from camera without going to Usephoto page. I want to stay on camera view. I'm not able to get camera spinner action.I used custom overlay but in that Square focus not coming.Please help me.I want all default camera features.
Once you use custom overlay you will not be able to see default camera features.If you want all default features you should use
self.picker.showsCameraControls = YES;
This opens default camera and you can see all features.
If you want to go with custom overlay then you need to built all features.

Unable to configure launch screen appearance using view controller file

I have a LaunchScreen.storyboard which serves as the launch screen file. In this storyboard is a view controller with the class LaunchViewController.
In my LaunchViewController.m file I changed the view's background color and added a label with the FB shimmering effect (https://github.com/facebook/Shimmer).
_shimmeringView = [[FBShimmeringView alloc] init];
_shimmeringView.shimmering = YES;
_shimmeringView.shimmeringBeginFadeDuration = 0.3;
_shimmeringView.shimmeringOpacity = 0.3;
[self.view addSubview:_shimmeringView];
_logoLabel = [[UILabel alloc] initWithFrame:_shimmeringView.bounds];
_logoLabel.text = #"Shimmer";
_logoLabel.font = [UIFont fontWithName:#"HelveticaNeue-UltraLight" size:60.0];
_logoLabel.textColor = [UIColor whiteColor];
_logoLabel.textAlignment = NSTextAlignmentCenter;
_logoLabel.backgroundColor = [UIColor clearColor];
_shimmeringView.contentView = _logoLabel;
But when I ran it there's only an empty white background displayed as the launch screen. Also I find that he LaunchViewController looks fine when used as a regular view controller. How to make it display the same effect when used as launch screen?
You can't use code inside a launch view controller nib. Whether it is a storyboard or a separate nib. The code is not executed. The only thing that works is what is in InterfaceBuilder like auto layout and stuff. No code is loaded. This would defeat the purpose of using a launch file. The launcfile is loaded before the app has had chance to load.
No app, no code. Only the launch file.
I've had similar problems, and based on your code, it may be similar to mine. First off, I don't understand your question as much as I would like to. You said, "The LaunchViewController works fine when not used as launch screen." Does that mean that it looks the way you want it to look like when viewing on Xcode, but not on the simulator? I will try to provide possible solutions, and some trouble-shooting tips.
It could be something as simple as your background(or something) is at the front of the screen, blocking the rest. If so, you have to reconfigure the order of your items on your launch screen in your xib file in your application.
It could be an error on your part. Some of my programmer friends develop their launch screens using the Xcode interface: I find that easier to use, and it may have less errors.
It could be an issue with the iOS simulator. This is not likely to be true, but it could be. Try running the app on your device and see if it is fine there.
Troubleshooting: In order to trouble shoot your code, comment out your code, and load in all the elements of your launch screen one at a time, checking the iOS simulator and the console in between. You will eventually find the problematic code, and be able to fix it. From looking at your code, I don't see anything wrong (but don't take my word on it, I'm not familiar with coding the launchscreen/storyboard in swift. Good luck, and I hope my tips work. Also, if your launch screen is appearing fine inside Xcode, it is a programming error or an error on the iOS simulator. A picture or a description of your launch screen could also help future people who will answer this question.

AVCam Demo OverscanCompensation implementation

I'm currently working with the AVCam demo app to present a live camera feed over airplay or apple hdmi adapter for import into a HD camera switcher.
The issue I'm having is with OverScanCompensation to remove the huge black border from the mirrored view.
The only documentation I have found is to implement the screen.overscanCompensation = 3; method someplace? I have tried to put it into viewDidLoad and it will let me, but it doesn't change anything on the external view?
I had success of sorts with the Airplay Demo (quellish) using UIImagePicker, but I would much prefer to implement AVFoundation for this exercise.
Is there a better way to achieve what I'm looking for without having to implement separate view controllers?
All you need to do is, upon setting up the external screen (via, say, if ([[UIScreen screens] count] > 1) externalScreen = (UIScreen *)[[UIScreen screens] objectAtIndex:1];), set the overscanCompensation property of the above UIScreen instance to UIScreenOverscanCompensationInsetApplicationFrame (=2). It'll entirely get rid of both the border (overscanning) and image quality-deterioating scaling.
See http://www.iphonelife.com/blog/87/tv-display-output-why-does-your-picture-have-black-border-and-how-can-it-be-fixed for more info.

Disable PSPDFKit thumbnail

I'm trying to disable the thumbnail see image that comes with PSPDFKit, I'm not sure exactly what its called so I'm having a really hardtime finding it in the code. Anyone that has used this library before have any idea where this thumbnail is coming from, what its called, or has anything that might help! Thanks.
To Disable the ScrobbleBar(Thumbnail Preview) and Position Overlay(Page no:) of the PDF in PSPDFKit
you have to do the following
PSPDFViewController *pdfController = [[PSPDFViewController alloc] initWithDocument:yourMagazine];
pdfController.scrobbleBarEnabled = NO; // Disable the Bottom Scrobble Bar
pdfController.pageLabelEnabled = NO; // Disables the bottom document site position overlay.

Resources