<legend id='ArcZR'><style id='ArcZR'><dir id='ArcZR'><q id='ArcZR'></q></dir></style></legend>
      <bdo id='ArcZR'></bdo><ul id='ArcZR'></ul>

  1. <tfoot id='ArcZR'></tfoot>
  2. <small id='ArcZR'></small><noframes id='ArcZR'>

  3. <i id='ArcZR'><tr id='ArcZR'><dt id='ArcZR'><q id='ArcZR'><span id='ArcZR'><b id='ArcZR'><form id='ArcZR'><ins id='ArcZR'></ins><ul id='ArcZR'></ul><sub id='ArcZR'></sub></form><legend id='ArcZR'></legend><bdo id='ArcZR'><pre id='ArcZR'><center id='ArcZR'></center></pre></bdo></b><th id='ArcZR'></th></span></q></dt></tr></i><div id='ArcZR'><tfoot id='ArcZR'></tfoot><dl id='ArcZR'><fieldset id='ArcZR'></fieldset></dl></div>

    1. 如何获取当前正在显示的 tableView 的 indexPath.row?

      How to get indexPath.row of tableView which is currently being displayed?(如何获取当前正在显示的 tableView 的 indexPath.row?)

        <legend id='xqGI2'><style id='xqGI2'><dir id='xqGI2'><q id='xqGI2'></q></dir></style></legend>
              <tbody id='xqGI2'></tbody>

          • <tfoot id='xqGI2'></tfoot>
          • <i id='xqGI2'><tr id='xqGI2'><dt id='xqGI2'><q id='xqGI2'><span id='xqGI2'><b id='xqGI2'><form id='xqGI2'><ins id='xqGI2'></ins><ul id='xqGI2'></ul><sub id='xqGI2'></sub></form><legend id='xqGI2'></legend><bdo id='xqGI2'><pre id='xqGI2'><center id='xqGI2'></center></pre></bdo></b><th id='xqGI2'></th></span></q></dt></tr></i><div id='xqGI2'><tfoot id='xqGI2'></tfoot><dl id='xqGI2'><fieldset id='xqGI2'></fieldset></dl></div>

            <small id='xqGI2'></small><noframes id='xqGI2'>

              • <bdo id='xqGI2'></bdo><ul id='xqGI2'></ul>
                本文介绍了如何获取当前正在显示的 tableView 的 indexPath.row?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我有一个包含许多值的 tableView.

                I have a tableView with many values.

                我想获取当前正在显示的表格的第一个indexPath.row值.

                I want to get the first indexPath.row value of the table which is being displayed currently.

                我该怎么做?

                在实施 krishnabhadra 的回答时出现以下错误:

                I get Following Error while implementing krishnabhadra's answer:

                错误所在的行是:

                [self.table scrollToRowAtIndexPath:indexVis atScrollPosition:UITableViewScrollPositionTop animated:YES];
                

                错误:

                Assertion failure in -[NSIndexPath row], /SourceCache/UIKit_Sim/UIKit-1447.6.4/UITableViewSupport.m:2018
                2011-04-01 11:57:25.458 GlossaryPro[1525:207] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid index path for use with UITableView.  Index paths passed to table view must contain exactly two indices specifying the section and row.  Please use the category on NSIndexPath in UITableView.h if possible.'
                

                可能出了什么问题?

                推荐答案

                可以使用tableView indexPathsForVisibleRows 函数,它返回一个 NSArrayNSIndexPath 用于所有可见的 UITableViewCell.从 indexPath.row 你可以找到你的数组索引.

                You can use tableView indexPathsForVisibleRows function, which returns an NSArray of NSIndexPath for all visible UITableViewCell. From indexPath.row you can find your array index.

                NSArray *visible       = [tableView indexPathsForVisibleRows];
                NSIndexPath *indexpath = (NSIndexPath*)[visible objectAtIndex:0];
                

                indexPath.row 将为您提供显示的第一个对象的索引.

                indexPath.row will give you index of first object displayed.

                这篇关于如何获取当前正在显示的 tableView 的 indexPath.row?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                EAAccessory/EASession teardown during background(EAAccessory/EASession 在后台拆除)
                Getting an NSArray of a single attribute from an NSArray(从 NSArray 获取单个属性的 NSArray)
                ImageIO: lt;ERRORgt; JPEG Corrupt JPEG data: premature end of data segment iphone - how to catch this?(ImageIO:lt;错误gt;JPEG 损坏的 JPEG 数据:iphone 数据段过早结束 - 如何捕捉到这个?)
                Xcode iOS organizer submit to app store yields quot;The archive is invalidquot; error(Xcode iOS 管理器提交到应用商店产生“存档无效;错误)
                MFMessageComposeViewController alloc returns nil(MFMessageComposeViewController alloc 返回 nil)
                How to add and get the values from .plist in iOS(如何在 iOS 中从 .plist 添加和获取值)

                  <tbody id='L5AbV'></tbody>

                  <tfoot id='L5AbV'></tfoot>
                1. <i id='L5AbV'><tr id='L5AbV'><dt id='L5AbV'><q id='L5AbV'><span id='L5AbV'><b id='L5AbV'><form id='L5AbV'><ins id='L5AbV'></ins><ul id='L5AbV'></ul><sub id='L5AbV'></sub></form><legend id='L5AbV'></legend><bdo id='L5AbV'><pre id='L5AbV'><center id='L5AbV'></center></pre></bdo></b><th id='L5AbV'></th></span></q></dt></tr></i><div id='L5AbV'><tfoot id='L5AbV'></tfoot><dl id='L5AbV'><fieldset id='L5AbV'></fieldset></dl></div>
                      <bdo id='L5AbV'></bdo><ul id='L5AbV'></ul>
                      • <legend id='L5AbV'><style id='L5AbV'><dir id='L5AbV'><q id='L5AbV'></q></dir></style></legend>

                          <small id='L5AbV'></small><noframes id='L5AbV'>