[英]How to load a UIImage from file without caching in Monotouch?
如果我看一下這里的討論: http : //monotouch.2284126.n4.nabble.com/UIImageView-td4303177.html
兩者, UIImage.FromFile()
和UIImage.FromFileUncached()
映射到imageWithContentsOfFile:
並且不應該緩存,但是我的經驗是不同的,我很確定UIImage.FromFile()緩存(從我在Instruments中看到的) 。
這里的文檔(http://docs.xamarin.com/ios/tutorials/Working_with_Images)聲明UIImage.FromBundle()
確實緩存,但UIImage.FromFile()
沒有。 這仍然是真的嗎? 或者,如果圖像在應用程序包中,可能會有一些神奇的FromFile()
緩存?
有人可以說明正確的方法是什么:
UIImage.FromFile
和UIImage.FromFileUncached
是相同的 。 它們都調用相同的imageWithContentsOfFile:
selector。
Xamarin關於FromFileUncached
的文檔解釋了為什么這樣做了。
FromFile的別名,只是用一個更明確的名稱來引起人們對此調用的無緩存性質的注意,與FromBundle相比。
從歷史上看,此選擇器的原始API名為FromFileUncached
,而舊的FromFile
方法已映射到imageNamed:
- 但事實證明這是一個錯誤,因為后面的選擇器意味着來自bundle。
添加了一個新的FromBundle
方法,而不是破壞API, FromFile
變得與FromFileUncached
相同。
我將在FromFileUncached
方法中添加一個[Obsolete]
屬性,因為它會使IDE內部更加明顯,即無需閱讀文檔。
有人可以說明正確的方法是什么:
FromFile[Uncached]
不緩存, FromBundle
確實如此。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.