iOS Screen Brightness

I know it’s possible to change the brightness level of the screen by Declares, but don’t know how to do that. Can anyone help me get this working?

Currently traveling, but I’ll post the declares for this very soon.

Thanks in advance!

This should work:

// Obj-C code: [[UIScreen mainScreen] setBrightness: yourvalue];

Declare Function NSClassFromString Lib "Foundation" (aClassName As CFStringRef) As Ptr
Declare Function mainScreen Lib "UIKit" selector "mainScreen" (classRef As Ptr) As ptr
Declare sub setBrightness Lib "UIKit" selector "setBrightness:" (obj As Ptr, value As CGFloat)

Dim screenRef As ptr = mainScreen(NSClassFromString("UIScreen"))

setBrightness(screenRef, yourValue) //Accepts a value between 0.0 and 1.0

1 Like

Works like a charm, thanks!