支持动态检测屏幕亮度的功能源码

上传者: 38661100 | 上传时间: 2021-04-03 12:10:01 | 文件大小: 51KB | 文件类型: ZIP
支持动态检测屏幕亮度的功能源码,源码ASCScreenBrightnessDetector,可以动态检测屏幕亮度,提供delegate函数来即时响应屏幕亮度的变化。喜欢的朋友可以下载研究一下吧,ios源码频道提供下载。

ASCScreenBrightnessDetector

ASCScreenBrightnessDetector lets you easily detect screen brightness changes and provides some useful delegate methods.

For Example it is very easy to switch between a day and night theme optimized for different lighting conditions:


使用方法:

检测当前屏幕亮度:
ASCScreenBrightnessDetector *brightnessDetector = [ASCScreenBrightnessDetector new];

NSLog(@"Screen brightness: %f", brightnessDetector.screenBrightness);

ASCScreenBrightnessStyle style = brightnessDetector.screenBrightnessStyle;
switch (style) {
case ASCScreenBrightnessStyleDark:
// Do something, e.g. set a dark theme.
break;
case ASCScreenBrightnessStyleLight:
// Do something else, e.g set a light theme.
break;
}

响应屏幕亮度变化的delegate函数:
- (void)screenBrightnessDidChange:(CGFloat)brightness
{
NSLog(@"The new brightness is: %f", brightness);
}

- (void)screenBrightnessStyleDidChange:(ASCScreenBrightnessStyle)style
{
NSLog(@"The new style is: %u", style);
}

文件下载

资源详情

[{"title":"( 47 个子文件 51KB ) 支持动态检测屏幕亮度的功能源码","children":[{"title":"源码说明.htm <span style='color:#111;'> 3.08KB </span>","children":null,"spread":false},{"title":"帮助文档.url <span style='color:#111;'> 127B </span>","children":null,"spread":false},{"title":"更多海量源码下载.url <span style='color:#111;'> 127B </span>","children":null,"spread":false},{"title":"ASCScreenBrightnessDetector-master","children":[{"title":".gitignore <span style='color:#111;'> 243B </span>","children":null,"spread":false},{"title":"ASCScreenBrightnessDetector.podspec <span style='color:#111;'> 876B </span>","children":null,"spread":false},{"title":"Example","children":[{"title":"ASCScreenBrightnessDetectorExample.xcodeproj","children":[{"title":"project.xcworkspace","children":[{"title":"contents.xcworkspacedata <span style='color:#111;'> 179B </span>","children":null,"spread":false}],"spread":true},{"title":"project.pbxproj <span style='color:#111;'> 22.95KB </span>","children":null,"spread":false}],"spread":true},{"title":"ASCScreenBrightnessDetectorExample.xcworkspace","children":[{"title":"contents.xcworkspacedata <span style='color:#111;'> 194B </span>","children":null,"spread":false}],"spread":true},{"title":"Pods","children":[{"title":"Pods-acknowledgements.plist <span style='color:#111;'> 2.04KB </span>","children":null,"spread":false},{"title":"Pods-ASCScreenBrightnessDetector.xcconfig <span style='color:#111;'> 0B </span>","children":null,"spread":false},{"title":"Pods-dummy.m <span style='color:#111;'> 112B </span>","children":null,"spread":false},{"title":"Pods-resources.sh <span style='color:#111;'> 3.47KB </span>","children":null,"spread":false},{"title":"Pods-acknowledgements.markdown <span style='color:#111;'> 1.22KB </span>","children":null,"spread":false},{"title":"Pods-ASCScreenBrightnessDetector-dummy.m <span style='color:#111;'> 168B </span>","children":null,"spread":false},{"title":"Headers","children":[{"title":"ASCScreenBrightnessDetector","children":[{"title":"ASCScreenBrightnessDetector.h <span style='color:#111;'> 49B </span>","children":null,"spread":false}],"spread":false}],"spread":false},{"title":"Manifest.lock <span style='color:#111;'> 349B </span>","children":null,"spread":false},{"title":"Pods.xcconfig <span style='color:#111;'> 319B </span>","children":null,"spread":false},{"title":"Pods-ASCScreenBrightnessDetector-Private.xcconfig <span style='color:#111;'> 320B </span>","children":null,"spread":false},{"title":"Pods-ASCScreenBrightnessDetector-prefix.pch <span style='color:#111;'> 77B </span>","children":null,"spread":false},{"title":"Local Podspecs","children":[{"title":"ASCScreenBrightnessDetector.podspec <span style='color:#111;'> 878B </span>","children":null,"spread":false}],"spread":false},{"title":"Pods-environment.h <span style='color:#111;'> 505B </span>","children":null,"spread":false},{"title":"Pods.xcodeproj","children":[{"title":"project.pbxproj <span style='color:#111;'> 26.59KB </span>","children":null,"spread":false}],"spread":false},{"title":"BuildHeaders","children":[{"title":"ASCScreenBrightnessDetector","children":[{"title":"ASCScreenBrightnessDetector.h <span style='color:#111;'> 49B </span>","children":null,"spread":false}],"spread":false}],"spread":false}],"spread":false},{"title":"ASCScreenBrightnessDetectorExampleTests","children":[{"title":"en.lproj","children":[{"title":"InfoPlist.strings <span style='color:#111;'> 45B </span>","children":null,"spread":false}],"spread":true},{"title":"ASCScreenBrightnessDetectorExampleTests.m <span style='color:#111;'> 755B </span>","children":null,"spread":false},{"title":"ASCScreenBrightnessDetectorExampleTests-Info.plist <span style='color:#111;'> 697B </span>","children":null,"spread":false}],"spread":true},{"title":"Podfile.lock <span style='color:#111;'> 349B </span>","children":null,"spread":false},{"title":"ASCScreenBrightnessDetectorExample","children":[{"title":"main.m <span style='color:#111;'> 381B </span>","children":null,"spread":false},{"title":"ASCSampleViewController.m <span style='color:#111;'> 4.38KB </span>","children":null,"spread":false},{"title":"ASCScreenBrightnessDetectorExample-Info.plist <span style='color:#111;'> 1.21KB </span>","children":null,"spread":false},{"title":"Images.xcassets","children":[{"title":"LaunchImage.launchimage","children":[{"title":"Contents.json <span style='color:#111;'> 442B </span>","children":null,"spread":false}],"spread":false},{"title":"AppIcon.appiconset","children":[{"title":"Contents.json <span style='color:#111;'> 333B </span>","children":null,"spread":false}],"spread":false},{"title":"moon.imageset","children":[{"title":"moon.png <span style='color:#111;'> 5.60KB </span>","children":null,"spread":false},{"title":"Contents.json <span style='color:#111;'> 238B </span>","children":null,"spread":false}],"spread":false},{"title":"sun.imageset","children":[{"title":"sun.png <span style='color:#111;'> 7.00KB </span>","children":null,"spread":false},{"title":"Contents.json <span style='color:#111;'> 237B </span>","children":null,"spread":false}],"spread":false}],"spread":false},{"title":"ASCScreenBrightnessDetectorExample-Prefix.pch <span style='color:#111;'> 344B </span>","children":null,"spread":false},{"title":"en.lproj","children":[{"title":"InfoPlist.strings <span style='color:#111;'> 45B </span>","children":null,"spread":false}],"spread":false},{"title":"ASCAppDelegate.h <span style='color:#111;'> 321B </span>","children":null,"spread":false},{"title":"ASCAppDelegate.m <span style='color:#111;'> 739B </span>","children":null,"spread":false},{"title":"ASCSampleViewController.h <span style='color:#111;'> 271B </span>","children":null,"spread":false}],"spread":true},{"title":"Podfile <span style='color:#111;'> 84B </span>","children":null,"spread":false}],"spread":true},{"title":"LICENSE <span style='color:#111;'> 1.06KB </span>","children":null,"spread":false},{"title":"CHANGELOG.md <span style='color:#111;'> 68B </span>","children":null,"spread":false},{"title":"Classes","children":[{"title":"ASCScreenBrightnessDetector.m <span style='color:#111;'> 2.16KB </span>","children":null,"spread":false},{"title":"ASCScreenBrightnessDetector.h <span style='color:#111;'> 1.54KB </span>","children":null,"spread":false}],"spread":true},{"title":"README.md <span style='color:#111;'> 3.76KB </span>","children":null,"spread":false}],"spread":true}],"spread":true}]

评论信息

免责申明

【只为小站】的资源来自网友分享,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,【只为小站】 无法对用户传输的作品、信息、内容的权属或合法性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论 【只为小站】 经营者是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。
本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二条之规定,若资源存在侵权或相关问题请联系本站客服人员,zhiweidada#qq.com,请把#换成@,本站将给予最大的支持与配合,做到及时反馈和处理。关于更多版权及免责申明参见 版权及免责申明