XCode 4 截取通用应用程序的屏幕截图 (iPhone/iPad)

发布于 2024-12-19 13:27:35 字数 297 浏览 2 评论 0原文

使用 XCode 4,如何截取我创建的通用应用程序 (iPhone/iPad) 的屏幕截图?

是否需要连接设备并运行应用程序才能截屏?

实际上,我在 iPad 上安装了 IOS SDK 4.3,它是最新的 IOS 5.1

,所以我无法在 iPad 上实际测试该应用程序。也许我可以下载最新的 SDK,但这需要很多时间。那么,如果我可以从模拟器或其他东西中获取屏幕截图,那就太好了?

它也是一个通用应用程序。那么我需要 iPhone(我只有 iPod touch 设备 IOS 4.2.1)和 iPad 屏幕截图吗?

Using XCode 4, how do I take screeenshot of a Universal app which I have created (iPhone/iPad) ?

Is it necessary to connect the device and run the app on that to take screenshot ?

Actually I have IOS SDK 4.3 installed and on the iPad, it is the latest IOS 5.1

So I cannot actually test the app on the iPad. May be I can download the latest SDK, but that would take a lot of time. So it would be great if I could get screensots from within the simulator or something ?

Also it is a Universal app. So I would need both iPhone (i have only iPod touch device IOS 4.2.1) and iPad screenshots ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

離殇 2024-12-26 13:27:35

当 iOS 模拟器打开时,您可以按 CMD-S 将屏幕图像保存到桌面。

When the iOS-Simulator is open, you can press CMD-S to save an image of the screen to your Desktop.

饮惑 2024-12-26 13:27:35

我没有安装 4.3 SDK,但您应该能够使用“编辑”菜单从 iOS 模拟器中截取屏幕截图。

如果“复制屏幕”项目不存在(可能是他们在更高版本中添加的),您应该在编辑菜单展开时尝试按控件(如果不起作用,请按选项键)。
在旧版本的 iOS 模拟器中,应该会出现“复制屏幕”菜单项。

然后只需将屏幕截图粘贴到预览或您最喜欢的图像编辑器中。


顺便提一句。当您创建 Ad-Hoc 版本并安装它时,您可以在 iPad 上测试该应用程序。

I don't have the 4.3 SDK installed but you should be able to take screenshots from the iOS Simulator with the Edit Menu.

If the "copy screen" item does not exist (could be they added that in a later version) you should try to press the control (and if that doesn't work the option key) while the edit menu is expanded.
In the older versions of the iOS Simulator the "copy screen" menu item should appear.

And then just paste the screenshot to Preview or your favorite image editor.


Btw. you can test the App on the iPad when you create an Ad-Hoc build and install it.

亢潮 2024-12-26 13:27:35

如果我正确理解了问题,只需使用 mac 快捷键来拍摄模拟器的屏幕截图?命令+Shift+4

If I understand the question correctly just use the mac shortcuts to take a screen shot of the simulator? command + shift + 4

注定孤独终老 2024-12-26 13:27:35

如果您想以编程方式在您的应用程序中制作屏幕截图,请编写此代码

    if ([[UIScreen mainScreen] respondsToSelector:@selector(scale:)])
        UIGraphicsBeginImageContextWithOptions(self.window.bounds.size, NO, [UIScreen mainScreen].scale);
    else
        UIGraphicsBeginImageContext(self.window.bounds.size);
    [self.window.layer renderInContext:UIGraphicsGetCurrentContext()];
    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    NSData * data = UIImagePNGRepresentation(image);
    [data writeToFile:@"screenshot.png" atomically:YES];

它将适用于 iPhone 和 iPad 设备。

如果您想制作 iOS 模拟器的正常屏幕截图,请运行您的应用程序并使用热键 - Cmd+Shift+4 ->空间->选择窗口。

If you want to make screenshot programmatically into your app then write this code

    if ([[UIScreen mainScreen] respondsToSelector:@selector(scale:)])
        UIGraphicsBeginImageContextWithOptions(self.window.bounds.size, NO, [UIScreen mainScreen].scale);
    else
        UIGraphicsBeginImageContext(self.window.bounds.size);
    [self.window.layer renderInContext:UIGraphicsGetCurrentContext()];
    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    NSData * data = UIImagePNGRepresentation(image);
    [data writeToFile:@"screenshot.png" atomically:YES];

It will work for both iPhone and iPad devices.

If you want to make a normal screenshot of iOS Simulator, then run your app and use hotkeys - Cmd+Shift+4 -> Space -> Select window.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文