使用MonoTouch在文件夹中选择图像 [英] Selecting image in folder using MonoTouch

查看:58
本文介绍了使用MonoTouch在文件夹中选择图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是单点触控,现在已经冻结了.我试图通过代码使用文件夹中的图像.

I'm using monotouch and am having a brainfreeze. I'm trying to by code use an image that's in a folder.

项目结构:

解决方案- 项目-图片-picture.jpeg

Solution - Project -Images -picture.jpeg

代码:

UIImage image = UIImage.FromFile("\\Images\\picture.jpeg");

我也尝试过:

UIImage image = UIImage.FromFile("Images\\picture.jpeg");

将构建操作设置为内容,并且只要将其保留在项目的根目录中,我就可以使用该图像而不会崩溃.我怎么了?

The build action is set to content and I can use the picture without crashing if I just leave it in the root of the project. What's my problem?

谢谢

推荐答案

哦,当然... iOS,路径通过/而不是\ ....

Oh of course... iOS, paths go by / and not \....

正确的代码: UIImage image = UIImage.FromFile("Images/picture.jpeg");

告诉您这是一次头脑冻结!

Told you it was a brainfreeze!

这篇关于使用MonoTouch在文件夹中选择图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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