2016-11-07 81 views
0

我在我的XAML的图片代码,作为ViewCell数据模板的一部分:XAML图像标签,但没有的iOS

我使用这行代码来设置绑定,包括图像名称:

messages.Add(new MessageModel { 
    title = "Stappen", 
    information = "3240", 
    additionalInfo = "Doel: 5000 stappen per dag", 
    messageTime = DateTime.Now, 
    pageToOpen = new ActivityPage(), 
    imageName="yellowwarningsmall.jpg" }); 

我的文件结构具有出现在Android的图片在PregnancyMobile.Droid/Resources/drawable /中,它可以工作,图像显示在Android中。在iOS上,我有PregnancyMobile.iOS/Resources中的图像,以及视网膜的升级版本。那里的图片有yellowwarningsmall.jpg,[email protected][email protected]。所有的iOS图像构建操作都是BundleResource。

现在,在iOS上,图像实际上并没有显示出来。我应该注意到我的测试环境是iOS模拟器,因为我没有一个物理iPhone来测试。 iOS应用程序中的其他所有内容都应呈现,除了图片。我错过了什么吗?

输出日志:http://pastebin.com/mUZRnNV0

+0

,你可以分享应用程序输出/输出窗口的日志? –

+0

您的图片在Resources文件夹中? – Enrico

+0

@Enrico是的。 – Fireprufe15

回答

0

索姆感谢@BrunoeCaceiro我想通了。显然,尽管互联网上的所有示例在图像源中都有文件扩展名,但您只能输入名称,而不能使用扩展名。

所以

messages.Add(new MessageModel { title = "Stappen", information = "3240", 
additionalInfo = "Doel: 5000 stappen per dag", messageTime = DateTime.Now, 
pageToOpen = new ActivityPage(), imageName="yellowwarningsmall.jpg" }); 

变为

messages.Add(new MessageModel { title = "Stappen", information = "3240", 
additionalInfo = "Doel: 5000 stappen per dag", messageTime = DateTime.Now, 
pageToOpen = new ActivityPage(), imageName="yellowwarningsmall" });