How would I make a view that turns off the LEDs? - ios

I have 2 views in my app: my root view has a button. When you click on that button, you get sent to another view. In that view, I just want to display a completely black screen, as if the iPhone was turned off. What object in the interface builder should I use for this? Sorry if it's a beginner question.

I don't think it's possible to turn the LEDs all the way off. You can however make it look like they are by turning the brightness all the way down in code like this:
[[UIScreen mainScreen] setBrightness:0.0];

If you enable proximity monitoring, then os will turn screen off.
Otherwise, the only way you can turn it off is by accessing undocumented methods (risking app store rejection)
Turn off display in iPhone OS (iOS)

Related

how to display the zoom-in view in the standard mode of the large-screen phone

Recently I was asked to adapt to large-screen phones because the standard mode view looks too small on large-screen phones. So I thought of a simple way: display the zoom-in view in the standard mode of the large-screen phone. But i can't find a good way to realize it.
The original idea was to set the currentMode setting of UIScreen, but iOS does not support the creation of external UIScreenMode...
If you are not using a storyboard, use code with frame. You can use masonry, use multipliedBy. If you don’t change anything code and want to directly adapt, that’s unlikely.

Show a view on main screen while the app is in background in ios

Thanks in advance.
Is it possible to show a capture screen like assistive touch view in ios when we click on application icon.Means i want to show the iPad screen and top on the with transparent background a view need to display.
I want to create an app like this after clicking the app icon i want a screen like this on my main screen and i can able to customize it and capture the selected area. is it possible to do that. and is there any api for that.
i don't think you are allowed to capture the home screen in public api. this question had similar request.
How can I take a screenshot of the iPhone home screen programmatically
UIGetScreenImage() mentioned in the answer is very useful, if you only targeting Jailbroken phones.
However, i found an open source library called "Record My screen", which claim can
Record the display even on non-jailbroken iPhones.
I personally didn't test that, since i believe Apple would somehow find that and pull the app off (that happened to several apps before). If you really interested in it, maybe you can learn something from that library.
Hope that helps you.

How i can disable the native camera buttons?

I need to disable the button, when i enter in the native camera, like portrait, and when i turn like landscape, i need to able the buttons again. How i can do?. In IOS.
Thanks so much.
Kind Regards.
It's probably easier rather than disabling the buttons (which could be confusing to a user), just to rotate the camera view into landscape when it's opened, and prevent any rotations to portrait. You've got a couple of options for that as well, which might make it easier to develop.

My IOS orientation acting very strange and won't listen to any programing-code?

As the title describes I am having a big "what the * is this" at my app atm. It seems I can't get the control over the orientation at all in the different slides.
I can only manage the orientation in one way, via the info-plist file. The problem is, info-plist file sets the orientation for the whole app and I am not interested in that.In some slides I want to allow Landscape left/right and others only Portrait and this is not doable vie info-plist?
I have tried my best to understand the problem but I can not say I have gained any bigger "aha moment" so far. I am using UINavigatorbar and Tabbar in my IOS-app which may occur the problem. How can I make the app to start listening to the code in each-file so I can manage the orientation localy ?
Are you using iOS 6? If so, the -shouldAutorotateToInterfaceOrientation method was deprecated.
You now have to override -supportedInterfaceOrientations and -preferredInterfaceOrientationForPresentation methods in order to manage screen orientation. You can do this globally or within individual view controllers.
See the UIViewController class reference for more details.

Airplay: Mirror subview on external window

a design / architectural question on airplay.
I have setup an external display in the AppDelegate:
UIScreen *externalScreen = UIScreen.screens.lastObject;
self.externalWindow = [[UIWindow alloc] initWithFrame:externalScreenFrame];
self.externalWindow.screen = externalScreen;
self.externalWindow.backgroundColor = [UIColor redColor];
Works fine, TV shows an empty screen in red.
Now I have a ViewController with a bunch of subviews, and one view should be shown on the device and the external screen. If I try this in ViewController.m:
[_appDelegate.externalWindow addSubview:self.deviceAndTVView];
deviceAndTVView will only show on the external screen, not on the device anymore.
What I would need is to have deviceAndTVView on the device, updating itself on touches / user interaction, and mirror those updates on the external screen.
Which is the right path to accomplish that?
Thanks for reading!
m
The technology called AirPlay mirroring is poorly named. It actually operates in two modes, one where the entire iOS device is mirrored to the AirPlay device, and in another mode where once the mirroring AirPlay device is connected, the developer has two UIWindow/UIScreen's to work with.
You are using the latter mode, which is often referred to as "mirroring", but really you have a completely separate window/screen to manage and there should be better terminology to refer to this mode of operation.
What you describe doing above is basically moving a UIView from the device window to the AirPlay window, and it's working exactly as it should!
There is no technical way for you to have a single instance of a UIView show on both of these windows - it will exist in one UIView hierarchy or the other, but not both at the same time. In other words, if you want the same thing to show on both screens, you need to create two instances of the same UIView, and add them respectively to the two windows, and then update both of them as they change.
While this may not be the super-convienent "mirroring" you were expecting, it's probably be a good thing because your UIView may have different aspect ratio on the device than it does on the AirPlay device. By having two different views, showing the same content, you can adjust the sizing of the AirPlay view to best use of the available resolution of the device.
I can think of a couple of ways of doing this. Have you looked at using KVO for this? Both the local and external views could observe whatever model or controller is driving their content.

Resources