xcode - Reset users default app brightness in applicationDidEnterBackground with swift -
i've been trying reset user's default device brightness in app delegate method: applicationdidenterbackground
using code:
uiscreen.mainscreen().brightness = screenbrightness!
the code gets called brightness not reset. know how working using swift (not obj-c)
this code looks correct, note not work in simulator, take effect on physical device.
also, ensure value of screenbrightness
between 0 , 1.
you not able change screen brightness while in background. apple's documentation:
brightness changes made app remain in effect while app active. system restores user-supplied brightness setting @ appropriate times when app not in foreground.
Comments
Post a Comment