2016-11-07 79 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" });