有关TableView的一些小杂碎(持续更新)
来源:互联网 发布:计算机排序算法有哪些 编辑:程序博客网 时间:2024/05/06 14:25
myTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
2.系统默认的cell点击后的颜色设置
cell.selectionStyle=UITableViewCellSelectionStyleNone; //无色
cell.selectionStyle=UITableViewCellSelectionStyleBlue; //蓝色
cell.selectionStyle = UITableViewCellSelectionStyleGray; //灰色
3.设置TableView分割线的颜色
[myTableView setSeparatorColor:[UIColor xxxx ]];//可以通过RGB设置
4.控制TableView分割线的长度和缩进
myTableView.separatorInset = UIEdgeInsetsMake(0, 10, 10, 10);
UIEdgeInsets UIEdgeInsetsMake
(
CGFloat top,
CGFloat left,
CGFloat bottom,
CGFloat right
);
5.在UITableViewStylePlain风格下消除TableView多余的单元格横线
[myTableView setTableFooterView:[[UIView alloc]init]];
6.消除ios7以上,TableView默认上方留有空余
self.automaticallyAdjustsScrollViewInsets =NO;
写在- (void)viewDidLoad里面即可
7.设置TableView不能滚动
self.tableView.scrollEnabled =NO;
8.tableview刷新某一组(带动画)
NSIndexSet *indexSet=[[NSIndexSet alloc]initWithIndex:2];
[tableview reloadSections:indexSet withRowAnimation:UITableViewRowAnimationAutomatic];
9.tableview刷新某一行或者某几行(带动画)
NSIndexPath *indexPath=[NSIndexPath indexPathForRow:3 inSection:0];
[tableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath,nil] withRowAnimation:UITableViewRowAnimationNone];
10.获取tableview的某一行cell后修改cell内容
当我们点击某个cell时,会执行下面这个方法,方法中调用另一方法执行具体操作:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if (0 == indexPath.section) {
[self btnActionForUserSetting:self];
}
}
- (void)btnActionForUserSetting:(id) sender {
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];
cell.textLabel.text= @"abc";
}
//cell = (BKCell *)button.superview;//button为cell上的button
cell = (BKCell *)button.superview.superview;
//获取位置
NSIndexPath *index = [TableView indexPathForCell:cell];
NSArray *arr = [[NSArray alloc] initWithObjects:index, nil];
//删除掉选中的cell
[TableView deleteRowsAtIndexPaths:arr withRowAnimation:UITableViewRowAnimationLeft];
- 有关TableView的一些小杂碎(持续更新)
- 杂碎小知识(持续更新)
- tableView的一些用法(持续更新)
- 有关matlab的一些积累,持续更新
- excel的一些小知识,持续更新
- 有关OJ中PE的一些解决方法(持续更新。。。)
- 实习的一些杂碎。
- gnome3的一些杂碎
- 一些小的算法(持续更新…………)
- sql语句的一些小积累 持续更新。。。
- linux 系统相关的一些小知识点(持续更新)
- iOS开发中一些有用的小代码(持续更新)
- 一些小问题的解决办法(持续补充更新)
- [持续更新]android stduio的一些小技巧
- 一些小的代码功能,记录一下(持续更新)
- 一些平时用到的技术小知识(持续更新)
- C#的一些小知识备记(持续更新)
- Python--一些重要的小tips【持续更新】
- 启动动画模拟器显示真机不显示
- USACO--2.1Hamming Codes
- POJ 1573-Robot Motion
- sqlldr 数据导入到Oracle
- java多线程中死锁情况的一个示例
- 有关TableView的一些小杂碎(持续更新)
- jQuery和CSS3超酷表单美化插件
- java基础之集合
- AngularJS入门学习
- rsync断点续传
- Extjs 4 单条刷新数据(单行操作)定时器监听 getAt();.getSelectionModel().select(flag);
- struct 和 class 不同点
- hdu 3613 Best Reward ( manacher+枚举)
- [Android Tools] Android Reverse Engineering Heaven tools :)