I’m trying to make a kind of brightness option panel. After typing this code:
NSString *string = [[NSString alloc] initWithFormat:@"%f", slider.value];
[[UIScreen mainScreen] setBrightness:string];
I got the following error:
Sending 'NSString *__strong' to parameter of incompatible type 'CGFloat' (aka 'float')
Why does this code not working?
You get this error because the
brightnessproperty is not aNSString, it is aCGFloat. Try: