zoukankan      html  css  js  c++  java
  • 线程间的通信

    //

    //  ZBMainViewController.m

    //  TestProject

    //

    //  Created by 张先森 on 14/12/5.

    //  Copyright (c) 2014年 zhibin. All rights reserved.

    //

    #import "ZBMainViewController.h"

    @interface ZBMainViewController ()

    @property(nonatomic,strong)UIImageView *imageview;

    @end

    @implementation ZBMainViewController

     bool isopen=NO;

    - (void)viewDidLoad {

        [super viewDidLoad];

        UIImageView  *imageview=[[UIImageView alloc] init];

        self.imageview=imageview;

        

        [self.view addSubview:imageview];

        

        [self InitControls];

    }

    -(void)InitControls{

        [self performSelectorInBackground:@selector(dowland) withObject:nil];

    }

    -(void)dowland{

        NSString *url=@"http://www.smzdm.com/resources/public/img/logo.png";

        

        

        NSURL *myurl=[NSURL URLWithString:url];

        

        

        NSData *data=[NSData dataWithContentsOfURL:myurl];

        

        UIImage *image=[UIImage imageWithData:data];

        

        [self performSelectorOnMainThread:@selector(detaildata:) withObject:image waitUntilDone:NO];

        

       

        [self.imageview performSelector:@selector(setImage:) onThread:[NSThread mainThread] withObject:image waitUntilDone:NO];

        

        

             [self.imageview performSelectorOnMainThread:@selector(setImage:) withObject:image waitUntilDone:NO];

    }

    -(void)detaildata:(UIImage *)image{

            self.imageview.image=image;

        

          [self.imageview sizeToFit];

      

    }

    @end

  • 相关阅读:
    poj2002 poj3432 正方形个数 (hash,二分)
    置换群
    poj1995快速幂取余
    poj3983 (24点)
    判断二叉树是否是完全二叉树
    判断两个二叉树是否同构(相似)
    poj2187 最远点对问题
    poj2079 求最大的三角形面积
    poj3714 最近点对
    Linq学习笔记延迟操作符(分区操作符)
  • 原文地址:https://www.cnblogs.com/zhibin/p/4152311.html
Copyright © 2011-2022 走看看