2010-12-17 91 views
1

我知道如何使用TTImageView,但現在我的項目中需要顯示來自受用戶名密碼保護的服務器的圖像。我無法弄清楚如何在TTImageView上設置用戶名密碼。這是我的代碼 -帶有身份驗證的TTImageView

 TTImageView *ttItemImage = [[TTImageView alloc] initWithFrame:CGRectMake(x, y, 40, 40)]; 
ttItemImage.urlPath = imageURL; 
[ttItemImage setBackgroundColor:[UIColor clearColor]]; 
ttItemImage.style= [TTShapeStyle styleWithShape:[TTRectangleShape 
       shape] next:[TTContentStyle styleWithNext:nil]]; 
ttItemImage.userInteractionEnabled = NO; 
ttItemImage.contentMode = UIViewContentModeScaleAspectFit; 

任何想法,如果這是可能的,如何做到這一點?

回答

1

如果是我這樣做,我會簡單地創建一個TTImageView的子類,並通過自定義調用重載到您的服務器。這樣,您可以添加用戶名和密碼以及您希望使用的任何其他標頭/方法。