斯坦福Developing iOS 8 Apps学习笔记(五)
来源:互联网 发布:北方医疗大数据 编辑:程序博客网 时间:2024/04/30 11:08
Scroll View
ContentSize:CGSize非常重要,如果不设置好ScrollView将没法用
ScrollView的一些基本操作
let upperLeftOfVisible:CGPoint = scrollView.contentOffSetscrollRectToVisible(CGRect, animated:Bool)
还可以设置
- whether scroll is enabled
- locking scroll direction
- style of scroll indications(call flashScrollIndicators when scroll view appear)
- whether the actual content is “inset” from content area(contentInset)
Zooming
注意:Zooming affect contentSize & contentOffSet
scrollView.minimumZoomScalescrollView.maximumZoomScale//scrollView's delegatefun viewForZoomingInScrollView(sender:UIScrollView) -> UIView//返回需要缩放的ViewzoomScale:CGFloatsetZoomScale(CGFloat, animated:Bool)zoomToTect(CGRect, animated:Bool)
UIScrollViewDelegate还有ScrollViewDidEndZooming等12个方法,可选
Multithreading
let queue:dispacth_queue_tdispatch_async(queue){}mainQ:dispatch_queue_t = dispatch_get_main_queue()mainQ:NSOperationQueue = NSOperationQueue.mainQueue()//other queues. QOS = Quality of ServiceQOS_CLASS_USER_INTERACTIVE //Quick and high priorityQOS_CLASS_USER_INITIATED //High priority, might take timeQOS_CLASS_UTILITY //Long runningQOS_CLASS_BACKGROUND //user not concerned with this(prefetching, etc.)let qos = Int(上面那些东西.Value)let queue = dispatch_get_global_queue(qos, 0)//Own serial queuelet serialQ = dispatch_queue_create("name", DISPATCH_QUEUE_SERIAL)
//DISPATCH_AFTERlet delayInSeconds = 25.0let delay = Int64(delayInSeconds * Double(NSEC_PER_MSEC))let dispatchTime = dispatch_time(DISPATCH_TIME_NOW, delay)dispatch_after(dispatchTime, dispatch_get_main_queue){}
GCD还可以做locking, protect critical sections, readers and writers, synchronous dispatch, etc.
Others
- @objc可以定义有可选的Protocol
- imageView.sizeToFit()可以让ImageView大小适合image
- view.window != nil可以说明我们在当前界面上
- 闭包中的引用循环
- 闭包是类的一个变量,闭包调用self.someMethod()
- 解决:
{[unowned self] in}
0 0
- 斯坦福Developing iOS 8 Apps学习笔记(五)
- 斯坦福Developing iOS 8 Apps学习笔记(一)
- 斯坦福Developing iOS 8 Apps学习笔记(二)
- 斯坦福Developing iOS 8 Apps学习笔记(三)
- 斯坦福Developing iOS 8 Apps学习笔记(四)
- 斯坦福Developing iOS 8 Apps学习笔记(六)
- 斯坦福Developing iOS 8 Apps学习笔记(七)
- Developing iOS 8 Apps with Swift 学习笔记
- 《Start Developing iOS Apps Today》学习笔记(三)心得体会
- Start Developing iOS Apps (Swift) 学习笔记 (1)
- Start Developing iOS Apps (Swift) 学习笔记 (2)
- 《Start Developing iOS Apps Today》学习笔记(一)部分翻译
- 《Start Developing iOS Apps Today》学习笔记(二)应用实现过程
- Developing iOS 8 Apps with Swift Lesson 11学习
- 斯坦福机器学习笔记五
- Start Developing iOS Apps Today
- Start Developing iOS Apps Today
- Start Developing iOS Apps Today
- java
- 在windows server 中批量绑定ip和mac的方法
- mysql中join的四种连接
- Matlab实时监控股票交易数据之Timer函数应用实例
- 黑马程序员——学习日记6
- 斯坦福Developing iOS 8 Apps学习笔记(五)
- 【硬件测试】华为2016校招·电路设计领域机考试题
- LeetCode_pascals-triangle
- 使用apktool + idea 调试smali
- 网络连接之——HttpClient(doGet和doPost)
- 解决Eclipse导入Android工程出错
- 给我半个小时记录一下最近
- 数据结构 前言
- C++基础---面向对象建模方法