Project 2

来源:互联网 发布:手机里相片裁剪软件 编辑:程序博客网 时间:2024/05/03 09:31

1.代码/工程结构(摘自Cocoachina)


2.屏幕宽高

[UIScreen mainScreen].bounds.size.width[UIScreen mainScreen].bounds.size.height

3.在iOS 7以上的机子中,使用UITableView或者UIScrollView时会出现内容自动偏移的情况。需要解决的话,在ViewController的viewDidLoad中

self.automaticallyAdjustsScrollViewInsets = NO;

4.异步清理缓存

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{                NSString *cachePath = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory,                                                                           NSUserDomainMask,                                                                           YES) objectAtIndex:0];                NSArray *files = [[NSFileManager defaultManager] subpathsAtPath:cachePath];                for (NSString *p in files) {                    NSError *error;                    NSString *path = [cachePath stringByAppendingPathComponent:p];                    if ([[NSFileManager defaultManager] fileExistsAtPath:path]) {                        [[NSFileManager defaultManager] removeItemAtPath:path error:&error];                    }                }


0 0
原创粉丝点击