Make the iPhone Screen Dim

后端 未结 2 465
名媛妹妹
名媛妹妹 2020-12-06 05:42

I have managed to ensure that the iPhone doesn\'t auto-lock using:

    [[ UIApplication sharedApplication ] setIdleTimerDisabled: YES ];

Bu

相关标签:
2条回答
  • 2020-12-06 06:02

    As of iOS 5 there is a public API in the UIScreen class. It has a brightness property that can be set. For those instances where you may want to go dimmer than the actual backlight allows, there is a wantsSoftwareDimming property that will automatically place a translucent layer that will give the appearance of being more dim than can be done in hardware. This is very similar to the method you came up with with the translucent UIView. It should be noted that using your solution or the software dimming API should not be used with many animations since you will pay a performance penalty with all the alpha blending.

    See UIScreen Class Reference

    0 讨论(0)
  • 2020-12-06 06:22

    in iOS 7 and later:

    yourViewController.view.tintAdjustmentMode = UIViewTintAdjustmentModeDimmed;
    
    0 讨论(0)
提交回复
热议问题