//创建一个队列
NSOperationQueue *operation=[[NSOperationQueue alloc]init];
//把任务放在NSBlockOperation里面
NSBlockOperation *myOperation=[NSBlockOperation blockOperationWithBlock:^{
NSData *firstData=[NSData dataWithContentsOfURL:[NSURL URLWithString:KURL1]]; dispatch_async(dispatch_get_main_queue(), ^{ _firstImageView.image=[UIImage imageWithData:firstData];
}); }]; //把第二任务添加到操作队列
[myOperation addExecutionBlock:^{
NSData *secondData=[NSData dataWithContentsOfURL:[NSURL URLWithString:KURL1]]; dispatch_async(dispatch_get_main_queue(), ^{ _secondImageView.image=[UIImage imageWithData:secondData];
}); }];
[operation addOperation:myOperation];

NSOperation使用系统提供子类的方法--处理复杂任务的更多相关文章

  1. 系统提供的dispatch方法

    h1, h2, h3, h4, h5, h6, p, blockquote { margin: 0; padding: 0 } body { font-family: "Helvetica ...

  2. iOS——系统提供的dispatch方法

    // 后台执行: dispatch_async(dispatch_get_global_queue(0,0), ^{ // something }); // 主线程执行: dispatch_async ...

  3. 【读书笔记】iOS-GCD-系统提供的dispatch方法

    系统提供的dispatch方法如下: //系统提供的dispatch方法 //后台执行: dispatch_async(dispatch_get_global_queue(0, 0), ^{ // s ...

  4. 选择排序法、冒泡排序法、插入排序法、系统提供的底层sort方法排序之毫秒级比较

    我的代码: package PlaneGame;/** * 选择排序法.冒泡排序法.插入排序法.系统提供的底层sort方法排序之毫秒级比较 * @author Administrator */impo ...

  5. UIView封装动画--iOS利用系统提供方法来做转场动画

    UIView封装动画--iOS利用系统提供方法来做转场动画 UIViewAnimationOptions option; if (isNext) { option=UIViewAnimationOpt ...

  6. UIView封装动画--iOS利用系统提供方法来做关键帧动画

    iOS利用系统提供方法来做关键帧动画 ios7以后才有用. /*关键帧动画 options:UIViewKeyframeAnimationOptions类型 */ [UIView animateKey ...

  7. UIView封装动画--iOS 利用系统提供方法来做弹性运动

    iOS 利用系统提供方法来做弹性运动 /*创建弹性动画 damping:阻尼,范围0-1,阻尼越接近于0,弹性效果越明显 velocity:弹性复位的速度 */ [UIView animateWith ...

  8. 如何在Windows Server 2008 R2没有磁盘清理工具的情况下使用系统提供的磁盘清理工具

    今天,刚好碰到服务器C盘空间满的情况,首先处理了临时文件和有关的日志文件后空间还是不够用,我知道清理C盘的方法有很多,但今天只分享一下如何在Windows Server 2008 R2没有磁盘清理工具 ...

  9. iOS系统提供开发环境下命令行编译工具:xcodebuild

    iOS系统提供开发环境下命令行编译工具:xcodebuild[3] xcodebuild 在介绍xcodebuild之前,需要先弄清楚一些在XCode环境下的一些概念[4]: Workspace:简单 ...

随机推荐

  1. Codeforces 660 C. Hard Process (尺取)

    题目链接:http://codeforces.com/problemset/problem/660/C 尺取法 #include <bits/stdc++.h> using namespa ...

  2. 关于IE开发人员工具(F12)找不到的问题

    关于IE开发人员工具(F12)找不到的问题 解决方案:第一步,像往常一样F12或者,工具->开发人员工具,点击后,这个时候你是看不到工具界面(当然,如果你正好遇到了找不到这个问题);第二步,这个 ...

  3. iOS设置导航栏样式(UINavigationController)

    //设置导航栏baritem和返回baiitem样式 UIBarButtonItem *barItem = [UIBarButtonItem appearance]; //去掉返回按钮上的字 [bar ...

  4. js ajax上传图片到服务器

    $("#up_goods_pic").on('change',function(){ var file = this.files[0]; var url = webkitURL.c ...

  5. thinkphp 3+ 观后详解 (2)

    接上一章的内容,我们继续来看Think.class.php文件的start方法 static public function start() { // 注册AUTOLOAD方法 spl_autoloa ...

  6. APK扩展文件及使用

    转自:http://blog.csdn.net/myarrow/article/details/7760579 一.APK扩展文件基本知识 Android Market (Google Play St ...

  7. apache2 添加perl支持

    官方文档,很详细了. https://httpd.apache.org/docs/2.0/howto/cgi.html#configuring   我修改了/etc/apache2/sites-ava ...

  8. Lockless Ring Buffer Design

    https://www.kernel.org/doc/Documentation/trace/ring-buffer-design.txt Lockless Ring Buffer Design == ...

  9. 新唐M0 ISP下载要点

    http://blog.csdn.net/rejoice818/article/details/7736029 一.注意:官方光盘内“Software Utilities”目录下,可找到ICP或ISP ...

  10. java 正则表达式学习

    一. Java正则表达式 在程序开发中,难免会遇到需要匹配.查找.替换.判断字符串的情况发生,而这些情况有时又比较复杂. 因此,学习及使用正则表达式,便成了解决这一矛盾的主要手段. 正则表达式是一种可 ...