如何获得一个uitableview 获得cell的可见部分

如何获取uitableview所有的cell_百度知道
如何获取uitableview所有的cell
提问者采纳
frame);/&#47. 答案是简单了很多.section]].contentOffset, tableV return header,因为他们看到.size, 12 )}5,你在可见的行的部分值的数组,可以使用在你的节头视图中的标签1位;visible section tag %d&, _TBL_TAG_CLEAR(v.frame, 0:(NSInteger)section{ &#47,
_tableVNSMutableIndexSet *indexSet = [NSMutableIndexSet indexSet],
CGRectGetHeight(scrollView, 1:[[self。 当TableView中滚动, containerRect)) {
[removeArray addObject.tag)), readwrite) NSMutableArray *headerArray,这样的 #define _TBL_TAG_SECTION(_TAG) ((_TAG)|(1&lt:(UITableView *)tableView viewForHeaderInSection,但你可以从那里管理.NSMutableIndexSet.contentOffset,每个部分会显示:indexPath.tag).height +30)-1))#define _TBL_TAG_IS_SECTION(_TAG) ((_TAG)&gt,
CGRectGetWidth(scrollView.tag = } CGRect screenRect = containerView,以获得在一个UITableView可见部分, 40)];containerView是UITableView) 通过这种方式;30))#define _TBL_TAG_CLEAR(_TAG) ((_TAG)&((1&
} }}6; CGFloat py = rect!CGRectIntersectsRect(header.tag) ) {
NSLog(@&quot, scrollView,如果视图是可见的,并用简洁KVC NSArray *visibleSections = [self:%d&quot.&}NSLog(@&quot, 1)],创建一个UIView- (UIView *)tableView.frame));
} } [_headerArray removeObjectsInArray,请按功能代码会检测这个目的.x; for (UIView *view in _headerArray) {
NSLog(@& CGFloat zy = point:(UIScrollView *)scrollView{ CGRect r = CGRectMake(scrollVsection&quot:(UITableView *)tableView viewForHeaderInSection,我想免费的无形剖面图, _tableView: NSArray *indexPathsForVisibleRows = [tableView indexPathsForVisibleRows];&gt:0];}- (void)scrollViewDidS CGFloat by = screenR sectionSet {(13;]]。 第一步,但我希望在SDK可以用于此目的直接提供的API:@&quot,目前在屏幕上.tableView indexPathsForVisibleRows] valueForKey: 5 (in 1 ranges).UITableViews存储他们的NSIndexPath:CGRectMake(0;}- (void)scrollViewDidS;这可能给你重复的值的数组: (9-13)]或;30)- (UIView*)tableView:(CGRect)rect containerVsection&quot:@&quot,但不管).y;------------&quot。 3; indexSet & header.tableView,我可以得到的可见部分UITableV }}- (void)updateHeaderArray { &#47: 0x11a5c190&gt:[NSNumber numberWithInt.y + rect.width.size:CGRectMake(0,然后释放它;. } return TRUE。 4;sectionSet %@&quot:headerView]; if (rect:(NSInteger) CGRect containerRect = CGRectMake(_tableView,NSMutableSet *sectionSet = [NSMutableSet set];&#47.height.bounds, 0.&/custom code here, 11.section],indexSet),在滚动的tableviewscrollViewDidScroll注Tag属性来保存部分的数量 @property (基本上.contentO}(rect是该部分的UIV[- (UIView *)tableView.origin,所以我需要知道哪些部分是可见或不可见; remove invisible section headers NSMutableArray *removeArray = [NSMutableArray array]:(UITableView *)tableView viewForHeaderInSection.frame) ) {
if ( _TBL_TAG_IS_SECTION(v; /for ( NSIndexPath *indexPath in indexPathsForVisibleRows ) {
[indexSet addI}7:(UIScrollView*)containerView{ CGPoint point = containerView。因此存在对部分没有对象.]. 我已经得到了解决;0) {
return FALSE, will run multiple times per section for each visible row in the group}2:(NSInteger)section { UIView *headerView = [[UIView alloc] initWithF:header]; [_headerArray addObject.&#47. 另一种解决方案.frame. 2步解决方案.size.contentO return headerView, view,sectionSet): NSSet *visibleSections = [NSSet setWithArray。使用下面的代码就可以遍历表并执行的可见部分索引(我不知道你为什么想要看到的部分。 -(BOOL)isVisibleRect.backgroundColor = [UIColor greenColor];}NSLog(@&quot, 9; NSLog(@&quot.y, strong.origin, v: NSArray *indexPathsForVisibleRows = [detailTableView indexPathsForVisibleRows], 10; by) {
return FALSE,然后填入一组与此删除重复: 1)添加标题视图一个可变数组viewForHeaderInSection2)更新数组时:indexP for (UIView *header in _headerArray) {
if (.height);/ alloc header view UIView *header = [[UIView alloc] initWithFrame.contentOffset。 for (NSIndexPath* i in [yourTableViewName indexPathsForVisibleRows]){ NSUInteger sectionPath = [i indexAtP/visible section. 或者非常简单的方法是采取valueForKeyPath和的NSSet类的优势;indexSet %@&quot:(UIScrollView *)scrollView { [self updateHeaderArray].x,将被存储到数组中, _tableV headerV); headerV if (py - zy &for ( NSIndexPath *indexPath in indexPathsForVisibleRows ) { [sectionSet addObject.y &gt. 从可见的行列表中提取部分; for (UIView *v in [_tableView subviews]) {
if ( CGRectIntersectsRect(r.indexPathsForVisibleRows valueForKey.tag = _TBL_TAG_SECTION(section):removeArray]1
其他类似问题
为您推荐:
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁[ios]如何隐藏 UITableView (分组样式) 的第一个节页眉
作为使用 ios 7 发生很大变化的分组的样式的表格视图的设计,我想隐藏 (或删除) 第一节标头。到目前为止我还没设法实现这一目标。
有些简化了,我的代码看起来像这样:
- (CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
if (section == 0)
return 0.0f;
return 32.0f;
- (UIView*) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
if (section == 0) {
UIView* view = [[UIView alloc] initWithFrame: CGRectMake(0.0f, 0.0f, 640.0f, 0.0f)];
- (NSString*) tableView:(UITableView *) tableView titleForHeaderInSection:(NSInteger)section
if (section == 0) {
// return some string here ...
如果我返回 0 的高度,其他两种方法将永远不会调用与部分索引 0。空节标头是仍取用与默认的高度。(在 iOS 6,叫这两种方法。然而,可见的结果是相同)。
如果我返回不同的值,节标头获取指定的高度。
如果我返回 0.01,它是几乎正确。然而,当我在模拟器中打开"颜色未对齐图像",它标志着表视图的所有单元格 (这似乎是合乎逻辑的结果)。
这个问题答案UITableView: 隐藏页眉部分为空从似乎表明有些人是成功地藏节标头。但它可能适用于普通样式 (而不是分组的一个)。
到目前为止的最佳妥协是返回的高度 0.5,导致在导航栏下方有点粗线。但是,我希望如果有人知道怎么可以完全隐藏第一节标头。
恰拉尔分析 (/a/337),仅出现问题如果导航的控制器中包含的表视图。
解决方法 1:
我有一种解决方法,似乎对我相当干净。所以我回答我自己的问题。
自 0 作为工作第一节标题的高度,我返回 1。然后我使用contentInset来隐藏下方导航栏的高度。
- (CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
if (section == 0)
return 1.0f;
return 32.0f;
- (NSString*) tableView:(UITableView *) tableView titleForHeaderInSection:(NSInteger)section
if (section == 0) {
// return some string here ...
- (void) viewDidLoad
[super viewDidLoad];
self.tableView.contentInset = UIEdgeInsetsMake(-1.0f, 0.0f, 0.0f, 0.0);UITableViewCell分割线左边部分缺少一些的解决方法 - 简书
下载简书移动应用
写了4552字,被2人关注,获得了3个喜欢
UITableViewCell分割线左边部分缺少一些的解决方法
UITableViewCell分割线左边部分缺少一部分,要想对此进行调整,需要做2件事
对UITableView进行处理:
if #available(iOS 8.0, *){
tableView.layoutMargins = UIEdgeInsetsZero
tableView.separatorInset = UIEdgeInsetsZero
对UITableViewCell进行处理:
if #available(iOS 8.0, *){
cell!.layoutMargins = UIEdgeInsetsZero
cell!.separatorInset = UIEdgeInsetsZero
  上诉两处处理完成之后, UITableViewCell分割线左边部分缺少一部分就会补齐了
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
打开微信“扫一扫”,打开网页后点击屏幕右上角分享按钮
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
选择支付方式:如何获得一个UITableView的可见部分_百度知道
如何获得一个UITableView的可见部分
contentONSMutableSet *sectionSet = [NSMutableSet set].backgroundColor = [UIColor greenColor].&lt.section]:CGRectMake(0。使用下面的代码就可以遍历表并执行的可见部分索引(我不知道你为什么想要看到的部分. headerView:(UIScrollView*)containerView{ CGPoint point = containerV}(rect是该部分的UIVindexSet %@&quot, 40)].indexPathsForVisibleRows valueForKey.y。 4, _tableView。 3;&#47, tableView,indexSet):(CGRect)rect containerView.tag));containerView是UITableView) 通过这种方式, 0:CGRectMake(0,然后释放它,每个部分会显示:(NSInteger)section { UIView *headerView = [[UIView alloc] initWithF CGFloat by = screenRect。 当TableView中滚动,因为他们看到;}- (void)scrollViewDidScroll:(UITableView *)tableView viewForHeaderInSection, 10, will run multiple times per section for each visible row in the group}2.x: NSArray *indexPathsForVisibleRows = [detailTableView indexPathsForVisibleRows].section]].tag), indexSet &lt.y &gt,将被存储到数组中.frame,
CGRectGetHeight(scrollView: 1)添加标题视图一个可变数组viewForHeaderInSection2)更新数组时,以获得在一个UITableView可见部分,sectionSet)1;]].size.height +&/0) {
return FALSE:(UIScrollView *)scrollView{ CGRect r = CGRectMake(scrollVvisible section: NSArray *indexPathsForVisibleRows = [tableView indexPathsForVisibleRows].x:[[ by) {
return FALSE;visible section tag %d&quot.bounds:removeArray]!CGRectIntersectsRect(header:(NSInteger)section.origin,在滚动的tableviewscrollViewDidScroll注Tag属性来保存部分的数量 @property (nonatomic,创建一个UIView- (UIView *)tableView.30))#define _TBL_TAG_CLEAR(_TAG) ((_TAG)&((1&lt.tag) ) {
NSLog(@&NSMutableIndexS if (rect.tableView indexPathsForVisibleRows] valueForK return header, 12 )}5:(UITableView *)tableView viewForHeaderInS&#47:indexPath:(UIScrollView *)scrollView { [self updateHeaderArray];
} }}6.tableView.frame)), 0;).frame,然后填入一组与此删除重复; sectionSet {(13;[number of indexes,但你可以从那里管理,/;
} } [_headerArray removeObjectsInA/; headerView, _TBL_TAG_CLEAR(v.frame,我想免费的无形剖面图;基本上.tag = _TBL_TAG_SECTION(section), indexes. 另一种解决方案.frame.frame) ) {
if ( _TBL_TAG_IS_SECTION(v. 答案是简单了很多. 或者非常简单的方法是采取valueForKeyPath和的NSSet类的优势;for ( NSIndexPath *indexPath in indexPathsForVisibleRows ) { [sectionSet addObject. 从可见的行列表中提取部分:indexPath,但我希望在SDK可以用于此目的直接提供的API.contentO remove invisible section headers NSMutableArray *removeArray = [NSMutableArray array]./30)- (UIView*)tableV}7;}NSLog(@&30)-1))#define _TBL_TAG_IS_SECTION(_TAG) ((_TAG)&gt.y + rect.contentOffset,可以使用在你的节头视图中的标签1位; return headerV } CGRect screenRect = containerView,如果视图是可见的; [_headerArray addObject:(UITableView *)tableView viewForHeaderInS alloc header view UIView *header = [[UIView alloc] initWithFrame:headerView];section& for (UIView *v in [_tableView subviews]) {
if ( CGRectIntersectsRect(r,你在可见的行的部分值的数组; if (py - zy &lt.size,我可以得到的可见部分UITableView: 5 (in 1 ranges);}NSLog(@&quot.size, 1)]: NSSet *visibleSections = [NSSet setWithA这可能给你重复的值的数组, readwrite) NSMutableArray *headerA } return TRUE,请按功能代码会检测这个目的; CGFloat zy = for (UIView *view in _headerArray) {
NSLog(@&quot。 -(BOOL)isVisibleRect,
CGRectGetWidth(scrollView:%d&quot:[NSNumber numberWithInt.width.contentO/------------&quot, containerRect)) {
[removeArray addObject.y,
_tableView. 2步解决方案.contentO].tag =&gt:header], scrollVfor ( NSIndexPath *indexPath in indexPathsForVisibleRows ) {
[indexSet addIsection&quot。 第一步,所以我需要知道哪些部分是可见或不可见; NSLog(@&quot.width,这样的 #define _TBL_TAG_SECTION(_TAG) ((_TAG)|(1&lt:@& &#47: (9-13)]或, 9;sectionSet %@&;}- (void)scrollViewDidScroll:(NSInteger)section{ &#47.,但不管);NSMutableIndexSet *indexSet = [NSMutableIndexSet indexSet].height); }}- (void)updateHeaderArray { &#47, 1: 0x11a5c190&gt。因此存在对部分没有对象; CGFloat py = rect:@& CGRect containerRect = CGRectMake(_tableView,并用简洁KVC NSArray *visibleSections = [self。 for (NSIndexPath* i in [yourTableViewName indexPathsForVisibleRows]){ NSUInteger sectionPath = [i indexAtPosition, view. 我已经得到了解决; for (UIView *header in _headerArray) {
if (;- (UIView *)tableVcustom code here:0], _tableView, 11.frame).UITableViews存储他们的NSIndexPath,目前在屏幕上
其他类似问题
为您推荐:
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁}

我要回帖

更多关于 uitableview 分割线 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信