關於NSCache的使用

2021-07-09 13:23:45 字數 499 閱讀 9560

1. nscache 和 nsmutabledictionary 比較

用法基本類似只是nscache 並沒有像字典那樣的操作

[self.imagecache setobject:image forkey:urlstr];

2. 當對 nscache  removeallobject 之後會出現無法再次賦值的問題

解決辦法 

運用 dispatch_once 方法延遲一秒執行清理操作即可

-(void)clearmemorycache

dispatch_after(dispatch_time(dispatch_time_now, (int64_t)(1 * nsec_per_sec)), dispatch_get_main_queue(), ^);

}

關於this 的使用

如有不對的地方請大家指出,呵呵.this 的使用 1.this是指當前物件自己。當在乙個類中要明確指出使用物件自己的的變數或函式時就應該加上this引用。如下面這個例子中 public class a public static void main string args 執行結果 s hellow...

關於MenuHelp的使用

很多程式都是有選單和狀態列,當用滑鼠點開選單移動選擇各選單項的時候,會在狀態列顯示關於該選單項的說明。這個功能mfc是封裝好的,用嚮導生成即可,但用api程式設計就得自己編寫 了,查了一下msdn,有個menuhelp函式可以做到,函式原型為 void menuhelp uint umsg,wpar...

關於 errno的使用

errno 是乙個全域性的變數,在 errno.h 中有它的定義 if defined mt defined dll defined mac crtimp extern int cdecl errno void define errno errno else ndef mt ndef dll crt...