带有 Xcode 和 Monotouch 的设计器中的图像 [英] Image in designer with Xcode and Monotouch

查看:26
本文介绍了带有 Xcode 和 Monotouch 的设计器中的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法让我在 Xcode XIB 设计器中为 MonoTouch 项目选择和使用对象的图像?

Is there a way to allow me to select and use an image for an object in the Xcode XIB designer for a MonoTouch project?

这比我目前的做法要快.

This would be quicker than for me to do it the way I am currently doing it.

目前,我将我想要的图像添加到 MonoDevelop 中的 Images 文件夹中.然后我在 Xcode 中打开 XIB 并添加我的新控件.我为它创建了一个插座.我回到 MonoDevelop 并添加如下代码:

Currently, I add the image I want to the Images folder within MonoDevelop. Then I open the XIB in Xcode and add my new control. I create an Outlet for it. I go back to MonoDevelop and add code such as the following:

imgLogo.Image = UIImage.FromFile("Images/logo_sm.png");

imgLogo.Image = UIImage.FromFile("Images/logo_sm.png");

出于某种原因,我无法在 Xcode 设计器中选择我的 MonoDevelop 图像.图像下拉选择器始终为空.

For some reason, I can't select my MonoDevelop images in Xcode designer. The image drop down selector is always empty.

无论如何我可以节省时间并在设计器中这样做?

Anyway I can save time and do it this way in the designer?

推荐答案

Xcode 只允许根级目录中的图像用于 xibs(即使它允许您选择根目录外的图像,它们只是不在应用程序运行时工作).作为临时解决方案,我们停止在根目录之外制作 MonoDevelop 导出图像.

Xcode only allows images in the root-level directory to be used for xibs (even though it allows you to select images outside the root, they just don't work when the app runs). As a temporary solution, we stopped making MonoDevelop export images outside of the root directory.

几周前,我完成了对Resource"文件夹的支持,你可以用它来包含你的图像和诸如此类的东西,这些文件夹将被专门同步到 Xcode 并放置在 Xcode 项目的根目录中(以及最终构建的应用程序),以便您可以在 Xcode UI 设计器中使用它们.

A few weeks ago, I finished implementing support for a "Resource" folder which you can use to contain your images and whatnot, which will be specially synced out to Xcode and placed in the root directory of the Xcode project (and the final built app) so that you can use them from within the Xcode UI designer.

MonoDevelop 的下一个主要版本将具有此功能.

The next major release of MonoDevelop will have this feature.

这篇关于带有 Xcode 和 Monotouch 的设计器中的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆