• 网络请求异步


        NSString *url_string = @"http://b33.photo.store.qq.com/psu?/05ded9dc-1001-4be2-b975-13e05bbe8a74/YQttQ6aq57DdFXI99mxZ1KO.MbUmc5tp7ltg8Vi1E4A!/b/YQEyvBMZvgAAYvh1zgrXSAAA&a=33&b=18&bo=4AGAAgAAAAABAEQ!&rf=photoDetail/psu.jpeg";

        //1.构造网络地址

        NSURL *url = [NSURL URLWithString:url_string];

        //2.构造网络请求

        NSURLRequest *request = [NSURLRequestrequestWithURL:url];

        //3.使用网络连接对象发送网络请求对象

        [NSURLConnectionsendAsynchronousRequest:request queue:[NSOperationQueuemainQueue]

         completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) {

               UIImage *image = [[UIImage alloc] initWithData:data];

               //图片的大小

               self.imageView.contentMode = UIViewContentModeRedraw;

               self.imageView.image = image;

         }];

  • 相关阅读:
    Python shutil模块
    Flask 上传文件
    Flask DBUtils
    flash-session
    Flash 上下文管理
    python 栈
    python 偏函数
    threding.local
    next() 与 nextLine() 区别
    Thread.sleep(1000*3); // 休眠3秒
  • 原文地址:https://www.cnblogs.com/zhucunliang/p/3466266.html
Copyright © 2020-2023  润新知