Advertise Books Events Forum News Social Networking Support Us

sdkIQ for iPhone
($4.99)

Shape Up
($0.99)

Your First iPhone App
($1.99)

iVidCam Free
(free)

Kid Art
($0.99)

iPUBQUIZ
(£1.19)

ArtStudio
($3.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 01-04-2009, 08:24 PM   #1 (permalink)
Registered Member
 
Join Date: Jan 2009
Posts: 23
Default Turning iPhone screen off or sleep

Hi, how can i turn the iphone screen off or to make it sleep programaticly from the app?
vitlance is offline   Reply With Quote
Old 01-05-2009, 12:42 AM   #2 (permalink)
Registered Member
 
tawpie's Avatar
 
Join Date: Jul 2008
Posts: 328
Default

you might try setting the window alpha to zero, but the app won't actually sleep until the phone goes to sleep by itself. Then you have to figure out how to know when to reset the alpha which is probably a bigger problem! Lest your user tries to wake their phone and is presented with a blank screen...

Probably not a great idea actually.
tawpie is offline   Reply With Quote
Old 01-05-2009, 02:25 AM   #3 (permalink)
New Member
 
Join Date: Nov 2008
Posts: 74
Default

Setting the window alpha won't do what you are thinking it will do. YOu can not turn the screen on/off because it is against the SDK rules. Another option would be to turn the screen brightness down (GraphicsServices), but that is also against Apple's rules.

Basically, there's nothing you can do without barring an AppStore release.
SkylarEC is offline   Reply With Quote
Old 01-05-2009, 03:48 AM   #4 (permalink)
Registered Member
 
Join Date: Jan 2009
Posts: 23
Default

Okey, thanks guys... but i have one more noob question How to acces to window's alpha parameter from the view?

Code:
window.alpha = 0;
It gives me an error
vitlance is offline   Reply With Quote
Old 01-05-2009, 11:54 AM   #5 (permalink)
Registered Member
 
tawpie's Avatar
 
Join Date: Jul 2008
Posts: 328
Default

it might be easier to set the alpha of each of your views to 0, rather than the window itself. I think (haven't tried this) that you can blank out all of the views by setting the alpha of the root view. Make the window.backgroundColor black... :-)
tawpie is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Enter the iPhone App Challenge!  Win $500!
» Advertisements
» Stats
Members: 23,888
Threads: 38,672
Posts: 169,756
Top Poster: smasher (2,553)
Welcome to our newest member, jackcohen
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 05:17 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0