Multithreating(多线程)

网络请求例子:

NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://..."]];
NSURLSessionConfiguration *configuration = nil;
NSURLSession *session = [NSURLSession sessionWithConfiguration:configuration];
NSURLSessionDownloadTask *task;
task = [session downloadTaskWithRequest:request
completionHandler:^(NSURL *location, NSURLResponse *response, NSError *error) {
dispatch_async(dispatch_get_main_queue(), ^{/* do UI thing */});
// or [self performSelectorOnMainThread:@selector(doUIthings) withObject:nil waitUntilDone:NO];
}];
[task resume];

在完成网络请求后,做一些UI操作,UI操作是在主线程完成

UIScrollView(滚动视图)

注意:需要设置scrollView的contentSize

scrollView.contentSize = CGSizeMake(3000, 2000);

设置缩放比例

scrollView.minimumZoomScale = 2.0;

scrollView.minimumZoomScale = 0.2;

CS193p Lecture 10 - Multithreating, UIScrollView的更多相关文章

  1. 【原】Coursera—Andrew Ng机器学习—课程笔记 Lecture 10—Advice for applying machine learning 机器学习应用建议

    Lecture 10—Advice for applying machine learning 10.1 如何调试一个机器学习算法? 有多种方案: 1.获得更多训练数据:2.尝试更少特征:3.尝试更多 ...

  2. CS193p Lecture 11 - UITableView, iPad

    UITableView 的 dataSource 和 delegate dataSource 是一种协议,由 UITableView 实现,将 Model 的数据给到 UITableView: del ...

  3. CS193p Lecture 9 - Animation, Autolayout

    Animation(动画) Demo Dropit续 Autolayout(自动布局) 三种添加自动布局的方法: 使用蓝色辅助虚线,右键选择建议约束(Reset to Suggested Constr ...

  4. CS193p Lecture 8 - Protocols, Blocks and Animation

    一.协议(Protocols) 1. 声明协议 @protocol Foo <Xyzzy, NSObject> // ... @optinal // @required //... @en ...

  5. CS193p Lecture 7 - Views, Gestures

    Views 如何绘制自定义图像 Gestures 如何处理用户手势操作 Views 1.它是基本的构造块,代表屏幕上一块矩形区域,定义了一个坐标空间,在此空间中可以绘制,可以添加触控事件: 2.它是分 ...

  6. CS193p Lecture 6 - UINavigation, UITabBar

    抽象类(Abstract):指的是这个类不能被实例化,只能被继承: OC中没有关键词来标明某个类是抽象类,只能在注释中标注一下: 抽象类中的抽象方法,必须是public的,使方法称为public的方法 ...

  7. CS193p Lecture 5 - View Controller Lifecycle

    1. UITextView @property(nonatomic,readonly,retain) NSTextStorage *textStorage 是 NSMutableAttributedS ...

  8. CS193p Lecture 4 - Foundation, Attributed Strings

    消息机制 调用一个实例(instance)的方法(method),就是向该实例的指针发送消息(message),实例收到消息后,从自身的实现(implementation)中寻找响应这条消息的方法. ...

  9. 【图机器学习】cs224w Lecture 10 - PageRank

    目录 PageRank Problems Personalized PageRank 转自本人:https://blog.csdn.net/New2World/article/details/1062 ...

随机推荐

  1. laravel C层 (控制器)

    <?php namespace App\Http\Controllers; use App\Index; use App\Http\Controllers\Controller; class I ...

  2. OpenGL ES入门详解

     http://blog.csdn.net/wangyuchun_799/article/details/7736928 1.决定你要支持的OpenGL ES的版本.目前,OpenGL ES包含1.1 ...

  3. Visual Studio 调试卡顿的解决方法

    将不用的断点删除 关闭调试时打开的"IntelliXXX的窗口" 上面的第2条测试有效! https://social.msdn.microsoft.com/Forums/zh-C ...

  4. assembly x86(nasm)修改后的日常

    data segment ENG db 'SUNdayS Coming I Wanna Drive My Car,SUN,SUN$' ;9,3 sun1 db 'SUN' swcount db 0ah ...

  5. NEERC2017:L - Laminar Family

    传送门 很容易想到,离线按路径长度从大到小排个序,用树链剖分加颗支持区间cover的线段树就好了 代码: #include<cstdio> #include<iostream> ...

  6. C【C#公共帮助类】分页逻辑处理类

    using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Comm ...

  7. Java | 基础归纳 | JPA

    https://www.javacodegeeks.com/2015/04/jpa%E5%85%A5%E9%97%A8%E6%95%99%E7%A8%8B.html JPA 全称====>Jav ...

  8. SRE思想

    1 规模效应 业务越庞大,服务器就越多,服务越多,就越需要拆分成分布式架构.架构越复杂,对运维的能力要求就越高.出错的概率就越大,运维的工作量就越大.因此就要更多开发提升效率的工具. 而在小企业,业务 ...

  9. [Chrome](CSS) 解决Chrome font-size 小于 12px 无效

    Chrome中 font-size 小于 12px 会失效. 解决的办法一种是: -webkit-text-size-adjust:none; (但是Chrome27之后取消了支持) 利用CSS3的缩 ...

  10. python入门之流程控制

    if else 格式: if 条件 command1 command2elif 条件: command3    command4 else: command3 command4 注意条件后和else后 ...