Possible Duplicate:
Programmatically lock and unlock iPhone screen
i.e. A software button that will replicate the hardware screen lock button.
And, can I make a slider that will completely shut down the device?
Possible Duplicate:
Programmatically lock and unlock iPhone screen
i.e. A software button that will replicate the hardware screen lock button.
And, can I make a slider that will completely shut down the device?
You can, it's just a private API and you won't get into the AppStore. Fine in jailbroken or in-house/private apps, though.
extern void GSEventLockDevice();
- (void)lockScreen:(UIButton *)sender
{
GSEventLockDevice();
}
(Link against the GraphicsServices
private framework to use this.)
No. Those functionalities are not exposed by Apple's public APIs. There are possibilities (see other answers) if you don't need App Store legality.