共有62篇文章,第1页,共4页
-
-
删除cell最后一行时候报错 的解决方案[博客]
- 由于项目需要,做一个UITableView来实现删除功能。 效果如图: 功能思路其实不难: 交代一下,我自己要实现的效果: 1.TableView是分组的。 2.点击删除按钮后,某行被删除。 写完,大概功能,运行: 出现: *** Assertion failure in -[UITableView _endCellAnimationsWit...
-
-
IOS TableView的Cell高度自适应,UILabel自动换行适应[博客]
- 项目的源码下载地址:http://download.csdn.net/detail/swingpyzf/6835365 需求: 1、表格里的UILable要求自动换行 2、创建的tableViewCell的高度会自动适应内容的高度 一、用xcode构建项目,创建一个有tableView的视图,用纯代码的形式实现: 1、创建一个UIViewControlle...
-
-
UITableView的优化原理[博客]
- 当我们下啦一个 UITableView时,如果没有做优化,只是简单的实现功能代码如下,这样当我们有上百条tableviewcell的时候,我们滑动的非常快时会非常费内存,当然苹果公司不会让我们这样干,苹果公司会在程序启动加载页面的时候,只开辟出现在页面上的tableviewcell,剩下的就...
-
-
ios Coredata 关联 UITableView 数据自动更新[博客]
- 昨天写了一篇关于coredata的文章,自己觉得挺傻的文章。没想其它程序员看过后觉得更傻,于是今天决定写一篇厉害点的,首先写了一个coredata和uitableview结合的框架,非常简单实现了数据变化时对应的uitableview的视图也变化的效果。 1.考虑到很多地方都要用到fetch...
-
-
coredata 自动化刷新uitableview数据[博客]
- 今天下午看了好多coredata的知识,决定要自己写一个例子: 废话不多说,直接开始堆: 1.建一个简单的用到coredata的实例工程,里面包含一个uitableview,暂时不需要数据 2.创建一个coredata的entity,里面包含两个属性,第一个是name,第二个是title,其实title没有用...
-
-
UItableView初了解[博客]
- 学了ios开发有一段时间了,或许这就是做设计的人学程序的弊端,对于基本的概念一直还是不熟练,今天晚上回来了解了一下UItableView,然后整理一下思路方便后面复习查询,我的第一篇初心者总结~ 这张图就是我折腾后的结果,颜色真的亮瞎眼,在一个就是我用了Xcode5,版本对于...
-
-
IOS Table中Cell的重用reuse机制分析[博客]
- 解决代码: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *CellIdentifier = [NSString stringWithFormat:@"Cell%d%d", [indexPath section], [indexPath row]];//以indexPath来唯一确定cel...
-
-
代码创建UITableView的诡异[博客]
- 昨天在折腾UITableView,最终想实现的效果是在UITableViewCell里添加UIScrollView, 效果图如下: 初步设计是用代码生成UITableView,所以没有用到IB来创建View等控件。 几经波折,在自定义TableViewCell里成功添加了UIScrollView,而scrollview里面动态添加了N张远程图片。...
-
-
清除UITableView底部多余的分割线[博客]
- 1、加方法 -(void)setExtraCellLineHidden: (UITableView *)tableView { UIView *view = [UIView new]; view.backgroundColor = [UIColor clearColor]; [tableView setTableFooterView:view]; [view release]; } 2、在 - (void)viewDi...
-
-
UITableViewCell 中的Button事件向上寻找当前Cell[博客]
- // self.tableView 就是 UITableView对象实例
CGRect buttonRect = button.frame;
for (UITableViewCell *cell in [self.tableView visibleCells]) {
// 判断两个区域是否相交
if (CGRectIntersectsRect(buttonRect, cell.frame)) {
...
-
-
UITableViewCell 自定义选中颜色[博客]
- 1、系统内置颜色 //无色
cell.selectionStyle = UITableViewCellSelectionStyleNone;
//蓝色
cell.selectionStyle = UITableViewCellSelectionStyleBlue;
//灰色
cell.selectionStyle = UITableViewCellSelectionStyleGray; 2、 改变UITableViewCell选中时背景色:...
-
-
UITableViewCell 自动高度[博客]
- // 设置行高
// 首先要设置显示多行 cell.textLabel.numberOfLines = 0;
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
// 获取要显示的文本字符串
NSString *text = [_listArray objectAtIndex:inde...
-
-
UITableview 单选和重用[博客]
- // 选中操作
- (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// 取消前一个选中的,就是单选啦
NSIndexPath *lastIndex = [NSIndexPath indexPathForRow:_index inSection:0];
UITableViewCell *...
-
-
UITableView cellForRowAtIndexPath 代理方法介绍[博客]
- // 构建tableView的单元格
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
//必须用一个静态字符串
static NSString *cellIdentifier = @"cell";
// 判断是有空闲的cell,有进行重用,没...
-
-
UITableView 基本使用[二] 基本属性[博客]
- // 设置表视图的颜色
_tableView.backgroundColor = [UIColor yellowColor];
// 设置表视图的分割线的颜色
// _tableView.separatorColor = [UIColor purpleColor];
// 设置表视图的分割线的风格
_tableView.separatorStyle = UITableViewCellSep...
-
-
UITableView 基本使用[一][博客]
- 1、要使用UITableView必须用当前实现两个协议<UITableViewDataSource, UITableViewDelegate> UITableViewDataSource协议实现了数据加载的方法,UITableViewDelgate协议实现了UITableView外观设置,事件等方法。 // RootViewController.h 测试控制器
#import <UIKit/UIKi...
-
-
UITableView 详解 教程[博客]
- 看TableView的资料其实已经蛮久了,一直想写点儿东西,却总是因为各种原因拖延,今天晚上有时间静下心来记录一些最近学习的TableView的知识。下面进入正题,UITableView堪称UIKit里面最复杂的一个控件了,使用起来不算难,但是要用好并不容易。当使用的时候我们必须要考虑到...
-
-
uitableview中reloaddata cell中的label重叠显示而不是刷新显示 ...[博客]
- 使用带有identifier的cell,写一个UITableViewCell类,然后在该类中声明IBOutlet @property(nonatomic,strong) IBOutlet UILabel *timeLabel; 并在storyboard中连接。 在uitableview 中的cellForRowAtIndexPath方法中 static NSString *CellIdentifier = @"meetingCell"...
-
-
UITableView 添加长按手势UILongPressGestureRecognizer[博客]
- 给UITableView 添加长按手势,识别长按哪一行。 长按手势类UILongPressGestureRecognizer, 属性minimumPressDuration表示最短长按的时间 添加手势代码: UILongPressGestureRecognizer * longPressGr = [[UILongPressGestureRecognizer alloc] initWithT...
-
-
UITableView reloadData的正确方法。[博客]
- 相信很多人会遇到这种情况,当tableView正在滚动的时候,如果reloadData,偶尔发生App crash的情况。 这种情况有时候有,有时候没有,已经难倒了很多人。直至今天,我在stackoverflow上面,仍没有发现真正有说到其本质的帖子。我的处女贴,选择这个问题来阐述一下我的观点。...