zoukankan      html  css  js  c++  java
  • CGD---1--开辟并发新线程

    //填充数据

    - (void)fillInfoWith:(MyClassStudentsData *)myClassStudentsData

    {

        self.myClassStudentsData = myClassStudentsData;

        

        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{

            

                //耗时

                NSURL *url = [NSURL URLWithString:myClassStudentsData.picUrl];

                UIImage *image = [UIImage imageWithData:[NSData dataWithContentsOfURL:url]];

            

            if (image) {

                dispatch_async(dispatch_get_main_queue(), ^{

                    //更新界面

                    self.headImageView.image = image;

                    self.nameLabel.text = myClassStudentsData.name;

                    

                });

            }

        

        });

        

        if ([myClassStudentsData.name length] > 3) {

            self.nameLabel.font = [UIFont systemFontOfSize:15];

        }else

        {

            self.nameLabel.font = [UIFont systemFontOfSize:18];

        }

        

    }

  • 相关阅读:
    poj 1200 crasy search
    cdoj 1092 韩爷的梦
    fzu 2257 saya的小熊饼干
    zoj 3950 how many nines
    zoj 3963 heap partion
    fzu 2256 迷宫
    fzu 2253 salty fish
    hdu 2473 Junk-Mail Filter
    codeforces 129B students and shoes
    hdu 3367 Pseudoforest
  • 原文地址:https://www.cnblogs.com/leevaboo/p/4261978.html
Copyright © 2011-2022 走看看