开发者

TTImageView with authentication

开发者 https://www.devze.com 2023-01-31 15:23 出处:网络
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

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

精彩评论

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