计算缓存文件大小 - (void)getCacheSize { // 总大小 unsigned long long size = 0; // 获得缓存文件夹路径 NSString *cachesPath = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES).lastObject; NSString *dirpath = [cachesPath stringByAppendingPathCom…
在写sina 微博界面的过程中使用到了cell,那么就是在cell上添加一些控件,但是由于每条微博的内容都是不同的,所以在显示的过程中,出现了内容重叠的问题,其实就是UITableViewCell重用机制的问题. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Ce…
零.线程的注意点(掌握) 1.不要同时开太多的线程(1~3条线程即可,不要超过5条)2.线程概念1> 主线程 : UI线程,显示.刷新UI界面,处理UI控件的事件2> 子线程 : 后台线程,异步线程3.不要把耗时的操作放在主线程,要放在子线程中执行 一.NSThread(掌握) 1.创建和启动线程的3种方式1> 先创建,后启动// 创建NSThread *thread = [[NSThread alloc] initWithTarget:self selector:@selector(d…
IOS在Cell上的优化令人觉得底层框架的成熟,可是有些情形却会造成不必要的麻烦, 当使用了 UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:Identifier]; 有可能会造成画面重复的问题,此句的意思是,从tableView的队列里取出以"Identifier"名称的cell进行重用.所以问题必定会出现! 解决办法如下: UITableViewCell *cell = nil; if (!c…
*********** #import "HMViewController.h" #import "HMStatus.h" #import "HMStatusCell.h" #import "HMStatusFrame.h" @interface HMViewController () /** 保存statusFrame模型的数组 */ @property (nonatomic, strong) NSArray *status…
iOS回顾笔记(09) -- Cell的添加.删除.更新.批量操作 项目中经常有对UITableViewCell做各种操作的需求: 添加一个新的cell 删除某行cell 刷新cell上某行数据(如修改联系人信息) 批量操作cell(订餐) 下面就分别讲解一下工作中对Cell的各种操作 刷新数据方法 重新刷新屏幕上的所有cell [self.tableView reloadData]; 刷新特定行的cell [self.tableView reloadRowsAtIndexPaths:@[ [N…
在显示的过程中,出现了内容重叠的问题,其实就是UITableViewCell重用机制的问题. 解决方法一:对在cell中添加的控件设置tag的方法 在cell的contentView上需要添加控件,那么就可以对添加的控件设置tag,然后新建cell的时候先remove前一个cell tag相同的控件,再添加新的label,这样就不会出现cell内容的重叠.例如添加标签label [[cell viewWithTag:100] removeFromSuperview]; [[cell conten…
使用xib创建自定制cell   显示图片   创建一个继承UITableViewCell的类   勾选xib 如下是xib创建图 xib 向.h拖拽一个关联线 .h .m 2.代码创建(使用三方适配库进行适配Masonry三方代码适配) .h #import <UIKit/UIKit.h> @interface NFTrailerNextTableViewCell : UITableViewCell @property (nonatomic, strong) UIButton *imageB…
解决点击cell执行动画导致的重用问题 说明: 动画的细节都是裸露的,并没有封装,靠看官来优化了. 效果: 源码: https://github.com/YouXianMing/UITableViewSelectedAnimation 核心: // // YouXianMingCell.h // SelectedAnimation // // Created by YouXianMing on 15/4/17. // Copyright (c) 2015年 YouXianMing. All ri…
UITableView //项目中遇到的 - (void)selectRowAtIndexPath:(nullable NSIndexPath *)indexPath animated:(BOOL)animated scrollPosition:(UITableViewScrollPosition)scrollPosition; //可以滚动到指定的 cell并且选中 注意:解决 UIPopoverController中UITableViewController 中selectRowAtInde…