首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏ShaoYL

    iOS-UI控件之UITableView(四)- cell数据刷新

    self.tableView reloadData]; // 屏幕上的所有可视的cell都会刷新一遍 局部刷新方法 添加数据 NSArray *indexPaths = @[ [NSIndexPath indexPathForRow:0 inSection:0], [NSIndexPath indexPathForRow:1 inSection:0] withRowAnimation:UITableViewRowAnimationRight]; 删除数据 NSArray *indexPaths = @[ [NSIndexPath indexPathForRow:0 inSection:0], [NSIndexPath indexPathForRow:1 inSection:0] indexPathForRow:0 inSection:0], [NSIndexPath indexPathForRow:1 inSection:0]

    2.1K60发布于 2018-05-11
  • 来自专栏一“技”之长

    iOS UITableView代理方法详解 原

    *)indexPath; 设置某行是否可以被移动 - (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath; 三、UITableViewDelegate(tableView代理 *)indexPath; - (void)tableView:(UITableView *)tableView didUnhighlightRowAtIndexPath:(NSIndexPath *) willSelectRowAtIndexPath:(NSIndexPath *)indexPath; - (NSIndexPath *)tableView:(UITableView *)tableView :(NSIndexPath *)sourceIndexPath toProposedIndexPath:(NSIndexPath *)proposedDestinationIndexPath;   疏漏之处

    1.9K40发布于 2018-08-15
  • 来自专栏非典型技术宅

    UITableView进阶:常用代理方法及属性1. 常用属性2. 进阶的常用代理方法

    作用 allowsSelection BOOL 允许选中 allowsMultipleSelection BOOL 允许多选 indexPathsForSelectedRows NSArray < NSIndexPath *> 获取当前选中cell的indexPaths indexPathsForVisibleRows NSArray < NSIndexPath *> 当前可见行数 allowsSelection: 2.1 最最常用的方法:选中指定的cell //选中cell -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath { ``` //修改删除按钮文字 (NSString *) tableView:( UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath {

    1.5K20发布于 2018-06-28
  • 来自专栏一“技”之长

    iOS流布局UICollectionView系列二——UICollectionView的代理方法

    - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath :(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath 是否可以被移动,返回NO则不能移动 - (BOOL)collectionView:(UICollectionView *)collectionView canMoveItemAtIndexPath:(NSIndexPath ); 移动item的时候,会调用这个方法 - (void)collectionView:(UICollectionView *)collectionView moveItemAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath*)destinationIndexPath; 三、UICollectionViewDelegate协议         

    2.5K20发布于 2018-08-16
  • 来自专栏君赏技术博客

    托管UITableView多样式cell的第三方库ZHTableViewGroup

    通常在代理 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 返回不同的cell,甚至需要在在 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath group.rowNumber; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath pragma mark - UITableViewDelegate - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath identifier:KHomeCellStyleOneIdentifier]; cellOne.configCellComplete = ^(UITableViewCell *cell, NSIndexPath

    1K10发布于 2018-09-07
  • 来自专栏LeeCen

    UITableView 编辑状态(删除、添加、移动)

    Paste_Image.png 1)确定 cell 是否处于编辑状态 -(BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath 添加) -(UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath -(NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath { return YES; } 2.移动 -(void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath

    1.9K10发布于 2018-10-11
  • 来自专栏iOS开发攻城狮的集散地

    iOS UITableView获取特定位置的cell

    可见的cell数组 NSArray * array = [_rightTableView visibleCells]; //返回cell的IndexPath NSIndexPath ]; NSLog(@"滑到了第 %ld 组 %ld个",indexPath.section, indexPath.row); _currentIndexPath = [NSIndexPath indexPath.section]; [_leftTableView reloadData]; [_leftTableView scrollToRowAtIndexPath:[NSIndexPath ]; NSLog(@"滑到了第 %ld 组 %ld个",indexPath.section, indexPath.row); _currentIndexPath = [NSIndexPath indexPath.section]; [_leftTableView reloadData]; [_leftTableView scrollToRowAtIndexPath:[NSIndexPath

    5.8K80发布于 2018-05-23
  • 来自专栏谈补锅

    UITableView增加和删除、移动

    UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath //实现此方法,就可以移动单元格, 方法里面是让数据和样式移动保持一致 - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath{ // NSLog(@"移动了”"); TanPerson

    2.5K30发布于 2018-09-27
  • 来自专栏陈满iOS

    iOS·下载管理第三方框架初步调研

    UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath HJDownloadManager 移除任务示例 - (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath rowActionWithStyle:UITableViewRowActionStyleDefault title:@"删除" handler:^(UITableViewRowAction *action, NSIndexPath UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath

    1.1K20发布于 2018-10-09
  • 来自专栏陈满iOS

    iOS小经验:UITableView&UICollectionView设置单元格的默认选中状态

    *)indexPath; //非选中 - (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath 之后,通过屏幕点击选中其它cell的时候,可以执行- (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath 比较 比如,下面两种方案 NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0]; UICollectionViewCell [self.collectionView selectItemAtIndexPath:[NSIndexPath indexPathForItem:0 inSection:0] animated:YES 如果你真的想在改变选中状态的时候执行didSelect代理,那么可以手动执行: NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection

    4.5K50发布于 2018-10-09
  • 来自专栏一“技”之长

    iOS中表视图(UITableView)使用详解

    *)indexPath; 获取某个点在tableView中的位置信息 - (NSIndexPath *)indexPathForRowAtPoint:(CGPoint)point;   获取某个cell 在tableView中的位置信息 - (NSIndexPath *)indexPathForCell:(UITableViewCell *)cell;  根据一个矩形范围返回一个信息数组,数组中是每一行 *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation; 移动某行 - (void)moveRowAtIndexPath:(NSIndexPath 代码示例如下: [tab beginUpdates];     [tab deleteRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:1 inSection   获取多选cell的位置信息 - (NSArray *)indexPathsForSelectedRows; 代码手动选中与取消选中某行 - (void)selectRowAtIndexPath:(NSIndexPath

    2K30发布于 2018-08-15
  • 来自专栏iOS开发干货分享

    iOS面向切面的TableView-AOPTableView

    *indexPath = [NSIndexPath indexPathForRow:arc4random() % 10 inSection:0]; [insertBodys addObject *)userIndexPathByFeeds:(NSIndexPath *)feedsIndexPath { if (! *> *array = self.sectionMap[@(section)]; NSInteger cutCount = 0; for (NSIndexPath *obj in array *)userIndexPathByFeeds:(NSIndexPath *)feedsIndexPath { if (! *> *array = self.sectionMap[@(section)]; NSInteger cutCount = 0; for (NSIndexPath *obj in array

    1.3K00发布于 2019-05-11
  • 来自专栏進无尽的文章

    UI篇-UICollectionView 补充

    *)collectionView layout:(UICollectionViewLayout *)**collectionViewLayout sizeForItemAtIndexPath**:(NSIndexPath :(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath 瀑布流.png 核心实现是在方法: - (UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSIndexPath 动态布局.gif 主要实现的过程用到了 一些新的collection view方法: beginInteractiveMovementForItemAtIndexPath(indexPath: NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath*)destinationIndexPath{ id obj = [_data objectAtIndex

    2.1K20发布于 2018-09-12
  • 来自专栏c#开发者

    ios5开发-UITableView开启编辑功能

     [array count];     }     } - (UITableViewCell *)tableView:(UITableView *)tv cellForRowAtIndexPath:(NSIndexPath                       }     return cell; } -(void)tableView:(UITableView *)tv didSelectRowAtIndexPath:(NSIndexPath tableView:(UITableView *)tv commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath } -(UITableViewCellEditingStyle )tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath  indexPathForRow:i inSection:0]];         }         NSArray *lastIndex=[NSArray arrayWithObject:[NSIndexPath

    96570发布于 2018-04-12
  • 来自专栏宜达数字

    iOS开发-UITableViewCell的创建方式

    这几天被这个基础控件搞的头疼 第一种方法: 纯手码(最土的方法) - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath Paste_Image.png - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath Paste_Image.png - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath indexPath]; } } - (UITableViewCell *)cell1:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath ID]; return cell; } - (UITableViewCell *)cell2:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath

    1.6K20发布于 2020-06-02
  • 来自专栏编程之旅

    iOS开发——UITableView勾选效果

    有以下几个注意点: - 首先在```- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *) 首先我们先声明一个变量,用来存储被选择的行数的标志 @property (nonatomic, strong) NSIndexPath *selectPath; //存放被点击的哪一行的标志 之后我们实现 ```- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath```这个代理方法 (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ int newRow YES]; } 最后看一下怎么在```- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath

    2.2K30发布于 2018-08-30
  • 来自专栏Alice

    效果类似于label从下往上滑(采用uiTableView实现)

    self.sumCount =[UIScreen mainScreen].bounds.size.height/40; } - (void)selectRowAtIndexPath:(nullable NSIndexPath YES]; } //设置每行的单元格的内容 -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath )tableView { return 1; } -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath self.shouDatas.count==self.count) { self.count=0; [self.showTableView selectRowAtIndexPath:[NSIndexPath UITableViewScrollPositionBottom]; } else { [self.showTableView selectRowAtIndexPath:[NSIndexPath

    1.5K50发布于 2018-02-01
  • 来自专栏iOS 备忘录

    轮播图实现的三种方式

    得到当前正在显示的cell的indexPath,(只有一个)     NSIndexPath *currentIndexPath = [[self.collectionView indexPathsForVisibleItems 得到YYMaxSections/2对应的section的indexPath,显示此indexPath对应的cell     NSIndexPath *currentIndexPathReset = [NSIndexPath 位移显示效果     NSIndexPath *nextIndexPath = [NSIndexPath indexPathForItem:nextItem inSection:nextSection]

    63210编辑于 2023-10-16
  • 来自专栏学海无涯

    iOS开发之UICollectionViewDataSourcePrefetching

    预加载数据 - (void)collectionView:(UICollectionView *)collectionView prefetchItemsAtIndexPaths:(NSArray<NSIndexPath void)collectionView:(UICollectionView *)collectionView cancelPrefetchingForItemsAtIndexPaths:(NSArray<NSIndexPath - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *> *)indexPaths { for (NSIndexPath * indexPath in indexPaths) { NSURL *currentURL *> *)indexPaths { for (NSIndexPath * indexPath in indexPaths){ NSURL *currentURL

    2.6K60发布于 2018-05-03
  • 来自专栏码客

    iOS UICollectionView的用法

    -(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, atIndexPath indexPath: NSIndexPath <cellCount { let indexPath = NSIndexPath(forItem:i, inSection:0) let attributes } // 这个方法返回每个单元格的位置和大小 override func layoutAttributesForItemAtIndexPath(indexPath: NSIndexPath } func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath

    1.8K20发布于 2019-10-22
领券