uiscreen

iOS Screen recording detection

旧时模样 提交于 2021-02-08 10:22:15
问题 I tried to detect if screen capture is on for the application for iOS 11, to detect this the UIScreen.mainScreen.isCaptured property is used to check if it is recorded. It works fine for the first launch, when the app is terminated and launched again, then the API returns NO though the screen capture is on. Code: //In viewWillAppear block __block ViewController *weakSelf = self; [NSTimer scheduledTimerWithTimeInterval:2.0 repeats:YES block:^(NSTimer * _Nonnull timer) { [weakSelf

How to find PPI programmatically with precision

一曲冷凌霜 提交于 2020-06-24 22:01:53
问题 I am trying to find out PPI(Pixels Per Inch) in iOS. I couldn't find any direct way to query this like we do for display size UIScreen.mainScreen().bounds There is a way to do it by multiplying scale with standard generic PPI for iPhone(163) or iPad(132) but it's not accurate. If the formula is right then PPI of iPhone 6 plus is 489 but in reality the PPI is 401 Here is the reference For now it seems like hardcoding is the way to go. But I'd like to do it programmatically using a formula. 回答1

How to disable screen Recording in iOS app

我的梦境 提交于 2020-06-24 13:45:18
问题 Is there any way to disable the screen recording? or is is possible through a configuration profile? or any third party library is available? 回答1: NotificationCenter.default.addObserver(self, selector: #selector(preventScreenRecording), name: NSNotification.Name.UIScreenCapturedDidChange, object: nil) And create a view inside main view and prevent like that. (void) preventScreenRecording { if (@available(iOS 11.0, *)) { BOOL isCaptured = [[UIScreen mainScreen] isCaptured]; if (isCaptured) {

setBrightness in appdelegate methods?

自古美人都是妖i 提交于 2020-01-04 05:29:14
问题 Why can't I set screen brightness in applicationDidEnterBackground or applicationWillResignActive? This is my code: - (void)applicationDidEnterBackground:(UIApplication *)application { [[UIScreen mainScreen] setBrightness:1.0]; } Can't understand it...!? It works in applicationDidEnterForeground etc, just not when i close the app using the home button. Thanks to anyone that can help... 回答1: It's probably because your app is relinquishing control to the OS, and the OS will then control the

setBrightness in appdelegate methods?

守給你的承諾、 提交于 2020-01-04 05:29:10
问题 Why can't I set screen brightness in applicationDidEnterBackground or applicationWillResignActive? This is my code: - (void)applicationDidEnterBackground:(UIApplication *)application { [[UIScreen mainScreen] setBrightness:1.0]; } Can't understand it...!? It works in applicationDidEnterForeground etc, just not when i close the app using the home button. Thanks to anyone that can help... 回答1: It's probably because your app is relinquishing control to the OS, and the OS will then control the

How can I detect whether a user has an iPhone 6 Plus in standard or zoomed mode?

大兔子大兔子 提交于 2019-12-28 01:55:28
问题 How can I detect whether a user has an iPhone 6 Plus in standard or zoomed mode? Is this possible? I've tried [UIScreen mainScreen].scale and it reports 3.0 in both cases. 回答1: The following code may be used to get bounds , coordinateSpace , nativeScale and scale , i.e. on an iPhone 6 Plus the nativeScale is 2.608 and when the device in run in Zoomed Mode it is 2.88 (note that it is different in the simulator): UIScreen *mainScreen = [UIScreen mainScreen]; NSLog(@"Screen bounds: %@, Screen

Window for an External Display affects primary screen

别来无恙 提交于 2019-12-25 04:31:45
问题 I create a new window when there is an additional screen (up to 2). Each window shows a different content, in a different screen. The problem is under iOS7: Creating and showing this external window makes the status bar visible in the first one, which is also the main one. Then, the system adds some space (20points) to rearrange the top bar and some views. It does not work for me, because it's a custom bar. Why is this happening and how may I stop the system to add the status bar? This is the

Unable to detect iPhone Retina 4-inch screen size in simulator

流过昼夜 提交于 2019-12-24 08:24:18
问题 I want to make my iOS application support iPhone 5. So I created a separate xib set for iPhone 5 size. Then I load each xib by checking the screen height. This is the splash screen loading code inside the AppDelegate.m: - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions { self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; // Override point for customization after application launch.