import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
// Override point for customization after application launch.
self.window!.backgroundColor = UIColor.whiteColor() self.window!.rootViewController = RootViewController(); self.window!.makeKeyAndVisible()
return true
}
}
import UIKit

class RootViewController: UIViewController {

    override func viewDidLoad() {
super.viewDidLoad() let imageView = UIImageView.init(frame: UIScreen.mainScreen().bounds);
imageView.backgroundColor = UIColor.greenColor()
self.view.addSubview(imageView) let url:NSURL = NSURL.init(string: "http://pic2.ooopic.com/11/86/60/84bOOOPIC13.jpg")!
let data:NSData = NSData(contentsOfURL: url)!
let image = UIImage(data: data)!
imageView.image = image } }

swift 同步加载图片的更多相关文章

  1. swift 异步加载图片(第三方框架ImageLoader)

    import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: ...

  2. swift 异步加载图片

    import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: ...

  3. swift 基础小结01 --delegate、Optional、GCD的使用、request请求、网络加载图片并保存到沙箱、闭包以及桥接

    本文主要记录swift中delegate的使用.“?!”Optional的概念.GCD的使用.request请求.网络加载图片并保存到沙箱.闭包以及桥接. 一.delegate的使用 swift中de ...

  4. android 网络加载图片,对图片资源进行优化,并且实现内存双缓存 + 磁盘缓存

    经常会用到 网络文件 比如查看大图片数据 资源优化的问题,当然用开源的项目  Android-Universal-Image-Loader  或者 ignition 都是个很好的选择. 在这里把原来 ...

  5. Android 异步加载图片,使用LruCache和SD卡或手机缓存,效果非常的流畅

      Android 高手进阶(21)  版权声明:本文为博主原创文章,未经博主允许不得转载. 转载请注明出处http://blog.csdn.net/xiaanming/article/details ...

  6. android优化从网络中加载图片速度。。

    从网络中加载图片主要要注意两个方面的问题: 1.内存管理:图片占的内存很大,假如图片数量多,很容易让系统抛出out of memory的异常. 同时我们也要注意不同android版本中内存管理的区别. ...

  7. javascript 同步加载与异步加载

    HTML 4.01 的script属性 charset: 可选.指定src引入代码的字符集,大多数浏览器忽略该值. defer: boolean, 可选.延迟脚本执行,相当于将script标签放入页面 ...

  8. 多线程异步加载图片async_pictures

    异步加载图片 目标:在表格中异步加载网络图片 目的: 模拟 SDWebImage 基本功能实现 理解 SDWebImage 的底层实现机制 SDWebImage 是非常著名的网络图片处理框架,目前国内 ...

  9. [置顶] 异步加载图片,使用LruCache和SD卡或手机缓存,效果非常的流畅

    转载请注明出处http://blog.csdn.net/xiaanming/article/details/9825113 异步加载图片的例子,网上也比较多,大部分用了HashMap<Strin ...

随机推荐

  1. nmap 高级扫描用法

    nmap提供了四项基本功能(主机发现.端口扫描.服务与版本侦测.OS侦测)及丰富的脚本库.Nmap既能应用于简单的网络信息扫描,也能用在高级.复杂.特定的环境中:例如扫描互联网上大量的主机:绕开防火墙 ...

  2. Android shell 命令总结

    Package Manage(PM) pm list packages [FILTER] 查看已安装的应用包 -f 显示关联的apk文件 -s 只在系统应用中搜索Filter -3 只在第三方应用中搜 ...

  3. ecshop session机制

    ecshop session机制 2014-06-12    1455     懒人程序   ecshop的cls_session.php分析,主要是讲述ecshop中的session机制.我们都知道 ...

  4. lvs简单配置

    负载均衡服务器将会用到两块网卡,eth0为公网地址(此处将局域网ip作为公网地址),IP地址为192.168.1.104,eth0:1,IP地址为192.168.2.1在负载均衡器上添加一个ip别名, ...

  5. Jsp入门学习笔记

    #Jsp入门 一.JSP基础语法 1.JSP指令: page inlcude taglib 2.JSP注释: a.html注释: <!-- abcdefghijklmn --> b.jsp ...

  6. nginx 配置多个二级域名

    server { server_name domain.com www.domain.com *.domain.com ; set $subdomain ''; if ($host ~* (\b(?! ...

  7. phone number is not known @w@ have no phone, and thus no phone number

    http://dev.mysql.com/doc/refman/5.7/en/problems-with-null.html B.5.4.3 Problems with NULL Values The ...

  8. Apache Apex

    http://apex.apache.org/docs.html https://apex.apache.org/docs/apex/application_development/

  9. nginx 反向代理 取得真实IP和域名

    nginx反向代理后,在应用中取得的ip都是反向代理服务器的ip,取得的域名也是反向代理配置的url的域名,解决该问题,需要在nginx反向代理配置中添加一些配置信息,目的将客户端的真实ip和域名传递 ...

  10. spark mllib 之线性回归

    public static void main(String[] args) { SparkConf sparkConf = new SparkConf() .setAppName("Reg ...