iOS掉進坑里幾個小時爬不出來
1.使用sd_setImageWithURL的問題(使用瀏覽器加載url圖片與用sd_setImageWithURL加載出來的圖片不同, 是為什么啊?)
方案:NSURL*url = [NSURLURLWithString:head];
NSLog(@"%@", url);
[cell.image sd_setImageWithURL:url placeholderImage:nil];
確認一下你的head里沒有中文以及其他 url 非法字符吧。如果有的話,需要先 encode。
并且,SDWebImage 是有緩存的??梢园?app 刪掉重新裝,看看是不是緩存的問題。
是因為SDWebImage 的緩存的問題 因為圖片的url沒有變所以影響了SDWebImage的使用,
[[SDImageCache sharedImageCache]removeImageForKey:head]; ?(這個代碼很重要)
NSURL *url =[NSURL URLWithString:head];
[cell.image sd_setImageWithURL:url];
這樣寫就好了
2.為什么給一個圓角的uiview添加陰影卻沒有效果?
詳細情況:此uiview在設置圓角的時候用了self.layer.masksToBounds = YES;?
方案:不要設置?? self.layer.masksToBounds = YES; 就可以看到陰影效果了 。
self.layer.shadowColor = [UIColor greenColor].CGColor;//陰影顏色
self.layer.shadowOffset = CGSizeMake(0, 0);//偏移距離
self.layer.shadowOpacity = 0.5;//不透明度
self.layer.shadowRadius = 10.0;//半徑
3.內(nèi)存泄漏,不走[CropViewController dealloc]的原因有哪些??
是以NSLog界面打印信息為準的
原因1,代理循環(huán)引用了
? ? ? ? ?2,工程處在release狀態(tài)下,NSLog不走(坑點)
? ? ? ? ?3,等等
4.入坑:NSInvalidArgumentException', reason: 'Can't add self as subview

解決辦法:
1.add和mastory的先后順序搞錯了,圖中注視的放開就會崩潰,(add的順序要和mastory約束的順序最好一樣)
