1、前题条件
1.1 UITableView不能直接加载到窗体中,窗体中首先要加载一个UIView控件,然后才可以添加UITableView
1.2 UITableView需要继续两个协议<UITableViewDelegate,UITableViewDataSource>
两个协议的方法为:
| --行的数量: -(NSInteger) tableView:(UITableView *)table numberOfRowsInSection:(NSInteger)section |
| --行的定义 -(UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath |
2、添加UIView
| //自定识别头及高度 //将view添加到主窗体 [self.view addSubview:view]; |
3、添加UITableView
| UITableView //添加到view窗体上 [view addSubview:table1]; |
4、取消点击动画
| |
5、滚动路径标识,直至指数连续接收器在屏幕上的特定位置
| - (void)scrollToRowAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UITableViewScrollPositio |
indexPath
索引路径标识在其行的索引,其部分指标表视图行。
scrollPosition
animated
是如果你要动画在位置改变,没有是否应立即生效。
实例代码:
| float height = 216.0; CGRect frame = m_pTableView.frame; [UIView beginAnimations:@"Curl"context:nil];//动画开始 [UIView commitAnimations]; | |
6、获取选中的列
| for (NSInteger i = 0; i < [[peopleTableView visibleCells] count]; i++) { UITableViewCell *cell = [[peopleTableView visibleCells]objectAtIndex:i]; if (cell.accessoryType == UITableViewCellAccessory { Item *item = (Item *)[NextPeopleList.SelectList objectAtIndex:i]; [peopleList addObject:item]; isCheck = TRUE; } } |
7、Cell将要显示时事件
| - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { if (indexPath.row % 2 == 0) { cell.backgroundColor = DarkColor; }else { cell.backgroundColor = LightColor; } |
![[转载]IPhone之UITableView [转载]IPhone之UITableView](https://i-blog.csdnimg.cn/blog_migrate/6e256094d1dd911a1872ef9272a86010.jpeg)
1198

被折叠的 条评论
为什么被折叠?



