iOS文档浏览与文件夹的状态变化的监听
2012-05-18 10:31
441 查看
iOS下的文档浏览以前采用过webview来实现,今天在无意中发现了QuickLook这个框架,是在SDK 3.2中添加的,看了下提供文档预览功能,实际效果类似于webview的展示效果,官方的例子为DocInteraction,其中代码中提到有三种方式:
// three ways to present a preview:
// 1. Don't implement this method and simply attach the canned gestureRecognizers to the cell
//
// 2. Don't use canned gesture recognizers and simply use UIDocumentInteractionController's
// presentPreviewAnimated: to get a preview for the document associated with this cell
//
// 3. Use the QLPreviewController to give the user preview access to the document associated
// with this cell and all the other documents as well.
这段话中的方法1看代码应该是指通过在长按时间出发打开动作,其他两个就是两种显示预览的方式,其中一段求文件大小的代码以后可以用用:
// three ways to present a preview:
// 1. Don't implement this method and simply attach the canned gestureRecognizers to the cell
//
// 2. Don't use canned gesture recognizers and simply use UIDocumentInteractionController's
// presentPreviewAnimated: to get a preview for the document associated with this cell
//
// 3. Use the QLPreviewController to give the user preview access to the document associated
// with this cell and all the other documents as well.
这段话中的方法1看代码应该是指通过在长按时间出发打开动作,其他两个就是两种显示预览的方式,其中一段求文件大小的代码以后可以用用:
if (size == 0) formattedStr = @"Empty"; else if (size > 0 && size < 1024) formattedStr = [NSString stringWithFormat:@"%qu bytes", size]; else if (size >= 1024 && size < pow(1024, 2)) formattedStr = [NSString stringWithFormat:@"%.1f KB", (size / 1024.)]; else if (size >= pow(1024, 2) && size < pow(1024, 3)) formattedStr = [NSString stringWithFormat:@"%.2f MB", (size / pow(1024, 2))]; else if (size >= pow(1024, 3)) formattedStr = [NSString stringWithFormat:@"%.3f GB", (size / pow(1024, 3))];还有一个类叫DirectoryWatcher,用于监视目录下文件删除或新增变化的,这个还是蛮不错的,可以学些下
相关文章推荐
- iOS 使用AFNetWorking监听APP网络状态变化(可用于更改缓存策略、提示网络等)
- iOS监听网络状态的变化
- iOS 实时监听文件夹的变化
- iOS 使用AFNetWorking监听APP网络状态变化(可用于更改缓存策略、提示网络等)
- iOS 监听文件夹变化
- iOS监控/监测/监听文件/文件夹的变化 检测文件变化
- iOS 监听wifi状态的变化
- iOS开发 实时监听UITextField内容的变化
- IOS--利用AFNetworking监听网络状态
- Android 实时监测(监听)网络连接状态变化
- iOS 监听App音量的变化(转)
- iOS 监听耳机状态
- angular 监听路由状态变化
- Flume监听文件夹中的文件变化,并把文件下沉到hdfs
- NetStateReceiver【监听网路状态变化】
- android 监听网络状态的变化及实战
- Android:检测网络状态&监听网络变化
- [iOS开发系列]根据Debug和Release状态的变化来屏蔽日志输出
- iOS监听手机锁屏状态
- iOS APP利用系统自带库监听网络状态