Wednesday, 15 January 2014

objective c - How to change brightness for single view -



objective c - How to change brightness for single view -

i'm newbie in programming iphone. inquire how alter screen brightness single view (controller). i'm using this.

- (void) loadview { [super loadview]; userbrightness = [[uiscreen mainscreen] brightness]; [[uiscreen mainscreen] setbrightness: 1.0]; } - (void) viewdidunload { [super viewdidunload]; [[uiscreen mainscreen] setbrightness: userbrightness]; }

but can't utilize 'viewdidunload' method because deprecated. don't know how homecoming previous value of backlight when switch view or terminate app. give thanks you

changing brightness on when view loads persistent, if view offscreen, brightness won't alter normal levels. remember concept of changing screen brightness global action, , not aware of context it's changed in (in case, applying when single view on screen). i'd suggest reading documentation on particulars of view lifecycle.

you consider using viewwillappear , viewwilldisappear, provide granularity need.

objective-c cocoa-touch

No comments:

Post a Comment