//
// 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