开发者

TTImageView with authentication

I know how to use TTImageView, but now I have this r开发者_开发知识库equirement in my project where we need to display images from a server which is protected by a username password. I am not able to figure out how to set username password on TTImageView. this is my code -

        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;

Any idea if that is possible at all and how to do that?


If it was me doing this I would simply create a subclass of TTImageView and override the reload method with a custom call to your server. That way you can add the username and password along with any other headers/methods you wish to use.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜