当用户点击我的应用程序图标时,我想在我的应用程序启动之前拍摄iPhone主屏幕的快照,就像iOS4系统在将应用程序置于后台模式之前一样。 (我也想知道我的应用程序图标的确切中心XY位置。)
有可能吗?
以下代码无效。 到那时,didFinishLaunchingWithOptions被称为主屏幕已经不见了。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
UIGraphicsBeginImageContext(self.window.frame.size);
[self.window.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil); // for debugging purpose
}
答案 0 :(得分:1)
很抱歉成为坏消息的承载者,但这似乎是隐私问题。
互联网世界中的许多博客等等已经谈到了这一点,所有人都摇摇头“NO”。
很抱歉,这是我们目前无法使用iphone执行的任务。