2014-04-30 20 views
1

我在我的應用程序中使用SDWebImage來設置按鈕圖像。但是當我嘗試去做SDWebImage UIButton setImageWithURL在iOS6上返回小圖像

[self.buttonPhoto setImageWithURL:self.user.avatarURL forState:UIControlStateNormal]; 

我看到圖像比它應該小兩倍。

enter image description here

比較我寫的按鈕

[self.buttonPhoto setImage:[UIImage imageNamed:@"sara"] forState:UIControlStateNormal]; 

設置局部圖像。在這種情況下,我看到正常的圖像。

enter image description here

可能是你瞭解這個問題,並知道解決辦法?日Thnx。

回答

0

嘗試使用佔位符圖像用這種方法:

[Button setImageWithURL:[NSURL URLWithString:ImageURL] placeholderImage:[UIImage imageNamed:@"placeholder.png"]]; 
0

的問題是關於實際的影像尺寸。圖片尺寸爲35x35像素,當按鈕框架 - 70x70px。我不明白爲什麼,但UIButton不希望縮放這樣的圖像。