Class: UITableView
- Inherits:
-
UIScrollView
- Object
- NSObject
- UIResponder
- UIView
- UIScrollView
- UITableView
Overview
An instance of UITableView (or simply, a table view) is a means for displaying and editing hierarchical lists of information.
Instance Attribute Summary (collapse)
-
- allowsMultipleSelection
A Boolean value that determines whether users can select more than one row outside of editing mode.
-
- allowsMultipleSelectionDuringEditing
A Boolean value that controls whether users can select more than one cell simultaneously in editing mode.
-
- allowsSelection
A Boolean value that determines whether users can select a row.
-
- allowsSelectionDuringEditing
A Boolean value that determines whether users can select cells while the receiver is in editing mode.
-
- backgroundView
The background view of the table view.
-
- dataSource
The object that acts as the data source of the receiving table view.
-
- delegate
The object that acts as the delegate of the receiving table view.
-
- editing
A Boolean value that determines whether the receiver is in editing mode.
-
- rowHeight
The height of each row (table cell) in the receiver.
-
- sectionFooterHeight
The height of section footers in the receiving table view.
-
- sectionHeaderHeight
The height of section headers in the receiving table view.
-
- sectionIndexColor
The color to use for the table view’s index text.
-
- sectionIndexMinimumDisplayRowCount
The number of table rows at which to display the index list on the right edge of the table.
-
- sectionIndexTrackingBackgroundColor
The color to use for the table view’s index background area.
-
- separatorColor
The color of separator rows in the table view.
-
- separatorStyle
The style for table cells used as separators.
-
- style
readonly
Returns the style of the receiver.
-
- tableFooterView
Returns an accessory view that is displayed below the table.
-
- tableHeaderView
Returns an accessory view that is displayed above the table.
Attributes inherited from UIScrollView
#alwaysBounceHorizontal, #alwaysBounceVertical, #bounces, #bouncesZoom, #canCancelContentTouches, #contentInset, #contentOffset, #contentSize, #decelerating, #decelerationRate, #delaysContentTouches, #directionalLockEnabled, #dragging, #indicatorStyle, #maximumZoomScale, #minimumZoomScale, #pagingEnabled, #panGestureRecognizer, #pinchGestureRecognizer, #scrollEnabled, #scrollIndicatorInsets, #scrollsToTop, #showsHorizontalScrollIndicator, #showsVerticalScrollIndicator, #tracking, #zoomBouncing, #zoomScale, #zooming
Attributes inherited from UIView
#alpha, #autoresizesSubviews, #autoresizingMask, #backgroundColor, #bounds, #center, #clearsContextBeforeDrawing, #clipsToBounds, #contentMode, #contentScaleFactor, #exclusiveTouch, #frame, #gestureRecognizers, #hidden, #layer, #multipleTouchEnabled, #opaque, #restorationIdentifier, #subviews, #superview, #tag, #transform, #userInteractionEnabled, #window
Attributes inherited from UIResponder
#inputAccessoryView, #inputView, #undoManager
Instance Method Summary (collapse)
-
- beginUpdates
Begin a series of method calls that insert, delete, or select rows and sections of the receiver.
-
- cellForRowAtIndexPath:
Returns the table cell at the specified index path.
-
- deleteRowsAtIndexPaths:withRowAnimation:
Deletes the rows specified by an array of index paths, with an option to animate the deletion.
-
- deleteSections:withRowAnimation:
Deletes one or more sections in the receiver, with an option to animate the deletion.
-
- dequeueReusableCellWithIdentifier:
Returns a reusable table-view cell object located by its identifier.
-
- dequeueReusableCellWithIdentifier:forIndexPath:
Returns a reusable table-view cell object for the specified reuse identifier.
-
- dequeueReusableHeaderFooterViewWithIdentifier:
Returns a reusable header or footer view located by its identifier.
-
- deselectRowAtIndexPath:animated:
Deselects a given row identified by index path, with an option to animate the deselection.
-
- endUpdates
Conclude a series of method calls that insert, delete, select, or reload rows and sections of the receiver.
-
- footerViewForSection:
Returns the footer view associated with the specified section.
-
- headerViewForSection:
Returns the header view associated with the specified section.
-
- indexPathForCell:
Returns an index path representing the row and section of a given table-view cell.
-
- indexPathForRowAtPoint:
Returns an index path identifying the row and section at the given point.
-
- indexPathForSelectedRow
Returns an index path identifying the row and section of the selected row.
-
- indexPathsForRowsInRect:
An array of index paths each representing a row enclosed by a given rectangle.
-
- indexPathsForSelectedRows
Returns the index paths represented the selected rows.
-
- indexPathsForVisibleRows
Returns an array of index paths each identifying a visible row in the receiver.
-
- initWithFrame:style:
Initializes and returns a table view object having the given frame and style.
-
- insertRowsAtIndexPaths:withRowAnimation:
Inserts rows in the receiver at the locations identified by an array of index paths, with an option to animate the insertion.
-
- insertSections:withRowAnimation:
Inserts one or more sections in the receiver, with an option to animate the insertion.
-
- moveRowAtIndexPath:toIndexPath:
Moves the row at a specified location to a destination location.
-
- moveSection:toSection:
Moves a section to a new location in the table view.
-
- numberOfRowsInSection:
Returns the number of rows (table cells) in a specified section.
-
- numberOfSections
Returns the number of sections for the receiver.
-
- rectForFooterInSection:
Returns the drawing area for the footer of the specified section.
-
- rectForHeaderInSection:
Returns the drawing area for the header of the specified section.
-
- rectForRowAtIndexPath:
Returns the drawing area for a row identified by index path.
-
- rectForSection:
Returns the drawing area for a specified section of the receiver.
-
- registerClass:forCellReuseIdentifier:
Registers a class for use in creating new table cells.
-
- registerClass:forHeaderFooterViewReuseIdentifier:
Registers a class for use in creating new table header or footer views.
-
- registerNib:forCellReuseIdentifier:
Registers a nib object containing a cell with the table view under a specified identifier.
-
- registerNib:forHeaderFooterViewReuseIdentifier:
Registers a nib object containing a header or footer with the table view under a specified identifier.
-
- reloadData
Reloads the rows and sections of the receiver.
-
- reloadRowsAtIndexPaths:withRowAnimation:
Reloads the specified rows using a certain animation effect.
-
- reloadSectionIndexTitles
Reloads the items in the index bar along the right side of the table view.
-
- reloadSections:withRowAnimation:
Reloads the specified sections using a given animation effect.
-
- scrollToNearestSelectedRowAtScrollPosition:animated:
Scrolls the table view so that the selected row nearest to a specified position in the table view is at that position.
-
- scrollToRowAtIndexPath:atScrollPosition:animated:
Scrolls the receiver until a row identified by index path is at a particular location on the screen.
-
- selectRowAtIndexPath:animated:scrollPosition:
Selects a row in the receiver identified by index path, optionally scrolling the row to a location in the receiver.
-
- setEditing:animated:
Toggles the receiver into and out of editing mode.
-
- visibleCells
Returns the table cells that are visible in the receiver.
Methods inherited from UIScrollView
#flashScrollIndicators, #scrollRectToVisible:animated:, #setContentOffset:animated:, #setZoomScale:animated:, #touchesShouldBegin:withEvent:inContentView:, #touchesShouldCancelInContentView:, #zoomToRect:animated:
Methods inherited from UIView
#addConstraint:, #addConstraints:, #addGestureRecognizer:, #addSubview:, #alignmentRectForFrame:, #alignmentRectInsets, animateWithDuration:animations:, animateWithDuration:animations:completion:, animateWithDuration:delay:options:animations:completion:, areAnimationsEnabled, beginAnimations:context:, #bringSubviewToFront:, commitAnimations, #constraints, #constraintsAffectingLayoutForAxis:, #contentCompressionResistancePriorityForAxis:, #contentHuggingPriorityForAxis:, #convertPoint:fromView:, #convertPoint:toView:, #convertRect:fromView:, #convertRect:toView:, #decodeRestorableStateWithCoder:, #didAddSubview:, #didMoveToSuperview, #didMoveToWindow, #drawRect:, #drawRect:forViewPrintFormatter:, #encodeRestorableStateWithCoder:, #endEditing:, #exchangeSubviewAtIndex:withSubviewAtIndex:, #exerciseAmbiguityInLayout, #frameForAlignmentRect:, #gestureRecognizerShouldBegin:, #hasAmbiguousLayout, #hitTest:withEvent:, #initWithFrame:, #insertSubview:aboveSubview:, #insertSubview:atIndex:, #insertSubview:belowSubview:, #intrinsicContentSize, #invalidateIntrinsicContentSize, #isDescendantOfView:, layerClass, #layoutIfNeeded, #layoutSubviews, #needsUpdateConstraints, #pointInside:withEvent:, #removeConstraint:, #removeConstraints:, #removeFromSuperview, #removeGestureRecognizer:, requiresConstraintBasedLayout, #sendSubviewToBack:, setAnimationBeginsFromCurrentState:, setAnimationCurve:, setAnimationDelay:, setAnimationDelegate:, setAnimationDidStopSelector:, setAnimationDuration:, setAnimationRepeatAutoreverses:, setAnimationRepeatCount:, setAnimationStartDate:, setAnimationTransition:forView:cache:, setAnimationWillStartSelector:, setAnimationsEnabled:, #setContentCompressionResistancePriority:forAxis:, #setContentHuggingPriority:forAxis:, #setNeedsDisplay, #setNeedsDisplayInRect:, #setNeedsLayout, #setNeedsUpdateConstraints, #setTranslatesAutoresizingMaskIntoConstraints:, #sizeThatFits:, #sizeToFit, #systemLayoutSizeFittingSize:, transitionFromView:toView:duration:options:completion:, transitionWithView:duration:options:animations:completion:, #translatesAutoresizingMaskIntoConstraints, #updateConstraints, #updateConstraintsIfNeeded, #viewForBaselineLayout, #viewPrintFormatter, #viewWithTag:, #willMoveToSuperview:, #willMoveToWindow:, #willRemoveSubview:
Methods inherited from UIResponder
#becomeFirstResponder, #canBecomeFirstResponder, #canPerformAction:withSender:, #canResignFirstResponder, #isFirstResponder, #motionBegan:withEvent:, #motionCancelled:withEvent:, #motionEnded:withEvent:, #nextResponder, #reloadInputViews, #remoteControlReceivedWithEvent:, #resignFirstResponder, #touchesBegan:withEvent:, #touchesCancelled:withEvent:, #touchesEnded:withEvent:, #touchesMoved:withEvent:
Methods inherited from NSObject
#!, #!=, #!~, #, #==, #===, #=~, #Rational, #__callee__, #__method__, #__send__, #__type__, `, alloc, allocWithZone:, #autoContentAccessingProxy, autoload, autoload?, autorelease_pool, #awakeAfterUsingCoder:, binding, block_given?, caller, cancelPreviousPerformRequestsWithTarget:, cancelPreviousPerformRequestsWithTarget:selector:object:, catch, class, classFallbacksForKeyedArchiver, #classForCoder, #classForKeyedArchiver, classForKeyedUnarchiver, #clone, conformsToProtocol:, #copy, copyWithZone:, #dealloc, #define_singleton_method, description, display, #doesNotRecognizeSelector:, #dup, #enum_for, #eql?, #equal?, #extend, fail, #finalize, format, #forwardInvocation:, #forwardingTargetForSelector:, framework, #freeze, #frozen?, getpass, gets, global_variables, #init, initialize, #initialize_clone, #initialize_copy, #initialize_dup, #inspect, instanceMethodForSelector:, instanceMethodSignatureForSelector:, #instance_eval, #instance_exec, #instance_of?, #instance_variable_defined?, #instance_variable_get, #instance_variable_set, #instance_variables, instancesRespondToSelector:, isSubclassOfClass:, #is_a?, iterator?, #kind_of?, lambda, load, load_bridge_support_file, load_plist, local_variables, loop, #method, #methodForSelector:, #methodSignatureForSelector:, #methods, #mutableCopy, mutableCopyWithZone:, new, #nil?, open, p, #performSelector:onThread:withObject:waitUntilDone:, #performSelector:onThread:withObject:waitUntilDone:modes:, #performSelector:withObject:afterDelay:, #performSelector:withObject:afterDelay:inModes:, #performSelectorInBackground:withObject:, #performSelectorOnMainThread:withObject:waitUntilDone:, #performSelectorOnMainThread:withObject:waitUntilDone:modes:, print, printf, #private_methods, proc, #protected_methods, #public_method, #public_methods, #public_send, putc, puts, raise, rand, readline, readlines, #replacementObjectForCoder:, #replacementObjectForKeyedArchiver:, require, resolveClassMethod:, resolveInstanceMethod:, #respond_to?, #respond_to_missing?, select, #send, setVersion:, #singleton_methods, sprintf, srand, superclass, #taint, #tainted?, #tap, test, throw, #to_plist, #to_s, trace_var, trap, #trust, #untaint, untrace_var, #untrust, #untrusted?, version
Constructor Details
This class inherits a constructor from NSObject
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class NSObject
Instance Attribute Details
- (Boolean) allowsMultipleSelection
A Boolean value that determines whether users can select more than one row outside of editing mode. This property controls whether multiple rows can be selected simultaneously outside of editing mode. When the value of this property is YES, a check mark is placed next to each row that is tapped. Tapping the row again removes the check mark. If you call indexPathsForSelectedRows, you can get the index paths that identify the selected rows.The default value of this property is NO.
- (Boolean) allowsMultipleSelectionDuringEditing
A Boolean value that controls whether users can select more than one cell simultaneously in editing mode. The default value of this property is NO. If you it to YES, check marks appear next to selected rows in editing mode. In addition, UITableView does not query for editing styles when it goes into editing mode. If you call indexPathsForSelectedRows, you can get the index paths that identify the selected rows.
- (Boolean) allowsSelection
A Boolean value that determines whether users can select a row. If the value of this property is YES (the default), users can select rows. If you set it to NO, they cannot select rows. Setting this property affects cell selection only when the table view is not in editing mode. If you want to restrict selection of cells in editing mode, use allowsSelectionDuringEditing.
- (Boolean) allowsSelectionDuringEditing
A Boolean value that determines whether users can select cells while the receiver is in editing mode. If the value of this property is YES , users can select rows during editing. The default value is NO. If you want to restrict selection of cells regardless of mode, use allowsSelection.
- (UIView) backgroundView
The background view of the table view. A table view’s background view is automatically resized to match the size of the table view. This view is placed as a subview of the table view behind all cells , header views, and footer views.Assigning an opaque view to this property obscures the background color set on the table view itself.
- (Object) dataSource
The object that acts as the data source of the receiving table view. The data source must adopt the UITableViewDataSource protocol. The data source is not retained.
- (Object) delegate
The object that acts as the delegate of the receiving table view. The delegate must adopt the UITableViewDelegate protocol. The delegate is not retained.
- (Boolean) editing
A Boolean value that determines whether the receiver is in editing mode. When the value of this property is YES , the table view is in editing mode: the cells of the table might show an insertion or deletion control on the left side of each cell and a reordering control on the right side, depending on how the cell is configured. (SeeUITableViewCell Class Reference for details.) Tapping a control causes the table view to invoke the data source method tableView:commitEditingStyle:forRowAtIndexPath:. The default value is NO.
- (Float) rowHeight
The height of each row (table cell) in the receiver. The row height is in points. You may set the row height for cells if the delegate doesn't implement the tableView:heightForRowAtIndexPath: method. If you do not explicitly set the row height, UITableView sets it to a standard value.There are performance implications to using tableView:heightForRowAtIndexPath: instead of rowHeight. Every time a table view is displayed, it calls tableView:heightForRowAtIndexPath: on the delegate for each of its rows, which can result in a significant performance problem with table views having a large number of rows (approximately 1000 or more).
- (Float) sectionFooterHeight
The height of section footers in the receiving table view. This value is used only in section group tables, and only if the delegate doesn't implement the tableView:heightForFooterInSection: method.
- (Float) sectionHeaderHeight
The height of section headers in the receiving table view. This value is used only if delegate the doesn't implement the tableView:heightForHeaderInSection: method.
- (UIColor) sectionIndexColor
The color to use for the table view’s index text. Table views can display an index along the side of the view, making it easier for users to navigate the contents of the table quickly. This property specifies the color to use for text displayed in this region.
- (Integer) sectionIndexMinimumDisplayRowCount
The number of table rows at which to display the index list on the right edge of the table. This property is applicable only to table views in the UITableViewStylePlain style. The default value is NSIntegerMax.
- (UIColor) sectionIndexTrackingBackgroundColor
The color to use for the table view’s index background area. Table views can display an index along the side of the view, making it easier for users to navigate the contents of the table quickly. This property specifies the color to display in the background of the index when the user drags a finger through it.
- (UIColor) separatorColor
The color of separator rows in the table view. The default color is gray.
- (UITableViewCellSeparatorStyle) separatorStyle
The style for table cells used as separators. The value of this property is one of the separator-style constants described in UITableViewCell Class Reference class reference. UITableView uses this property to set the separator style on the cell returned from the delegate in tableView:cellForRowAtIndexPath:.
- (UITableViewStyle) style (readonly)
Returns the style of the receiver. (read-only) See “Table View Style” for descriptions of the constants used to specify table-view style.
- (UIView) tableFooterView
Returns an accessory view that is displayed below the table. The default value is nil. The table footer view is different from a section footer.
- (UIView) tableHeaderView
Returns an accessory view that is displayed above the table. The default value is nil. The table header view is different from a section header.
Instance Method Details
- (Object) beginUpdates
Begin a series of method calls that insert, delete, or select rows and sections of the receiver. Call this method if you want subsequent insertions, deletion, and selection operations (for example, cellForRowAtIndexPath: and indexPathsForVisibleRows) to be animated simultaneously. This group of methods must conclude with an invocation of endUpdates. These method pairs can be nested. If you do not make the insertion, deletion, and selection calls inside this block, table attributes such as row count might become invalid. You should not call reloadData within the group; if you call this method within the group, you will need to perform any animations yourself.
- (UITableViewCell) cellForRowAtIndexPath(indexPath)
Returns the table cell at the specified index path.
- (Object) deleteRowsAtIndexPaths(indexPaths, withRowAnimation:animation)
Deletes the rows specified by an array of index paths, with an option to animate the deletion. Note the behavior of this method when it is called in an animation block defined by the beginUpdates and endUpdates methods. UITableView defers any insertions of rows or sections until after it has handled the deletions of rows or sections. This happens regardless of ordering of the insertion and deletion method calls. This is unlike inserting or removing an item in a mutable array, where the operation can affect the array index used for the successive insertion or removal operation. For more on this subject, see “Batch Insertion and Deletion of Rows and Sections” in Table View Programming Guide for iOS.
- (Object) deleteSections(sections, withRowAnimation:animation)
Deletes one or more sections in the receiver, with an option to animate the deletion. Note the behavior of this method when it is called in an animation block defined by the beginUpdates and endUpdates methods. UITableView defers any insertions of rows or sections until after it has handled the deletions of rows or sections. This happens regardless of ordering of the insertion and deletion method calls. This is unlike inserting or removing an item in a mutable array, where the operation can affect the array index used for the successive insertion or removal operation. For more on this subject, see “Batch Insertion and Deletion of Rows and Sections” in Table View Programming Guide for iOS.
- (Object) dequeueReusableCellWithIdentifier(identifier)
Returns a reusable table-view cell object located by its identifier. For performance reasons, a table view’s data source should generally reuse UITableViewCell objects when it assigns cells to rows in its tableView:cellForRowAtIndexPath: method. A table view maintains a queue or list of UITableViewCell objects that the data source has marked for reuse. Call this method from your data source object when asked to provide a new cell for the table view. This method dequeues an existing cell if one is available or creates a new one using the class or nib file you previously registered. If no cell is available for reuse and you did not register a class or nib file, this method returns nil. If you registered a class for the specified identifier and a new cell must be created, this method initializes the cell by calling its initWithStyle:reuseIdentifier: method. For nib-based cells, this method loads the cell object from the provided nib file. If an existing cell was available for reuse, this method calls the cell’s prepareForReuse method instead.
- (Object) dequeueReusableCellWithIdentifier(identifier, forIndexPath:indexPath)
Returns a reusable table-view cell object for the specified reuse identifier. For performance reasons, a table view’s data source should generally reuse UITableViewCell objects when it assigns cells to rows in its tableView:cellForRowAtIndexPath: method. A table view maintains a queue or list of UITableViewCell objects that the data source has marked for reuse. Call this method from your data source object when asked to provide a new cell for the table view. This method dequeues an existing cell if one is available or creates a new one based on the class or nib file you previously registered.Important: You must register a class or nib file using the registerNib:forCellReuseIdentifier: or registerClass:forCellReuseIdentifier: method before calling this method. If you registered a class for the specified identifier and a new cell must be created, this method initializes the cell by calling its initWithStyle:reuseIdentifier: method. For nib-based cells, this method loads the cell object from the provided nib file. If an existing cell was available for reuse, this method calls the cell’s prepareForReuse method instead.
- (Object) dequeueReusableHeaderFooterViewWithIdentifier(identifier)
Returns a reusable header or footer view located by its identifier. For performance reasons, a table view’s delegate should generally reuse UITableViewHeaderFooterView objects when it is asked to provide them. A table view maintains a queue or list of UITableViewHeaderFooterView objects that the table view’s delegate has marked for reuse. It marks a view for reuse by assigning it a reuse identifier when it creates it (that is, in the initWithReuseIdentifier: method of UITableViewHeaderFooterView). You can use this method to access specific template header and footer views that you previously created. You can access a view’s reuse identifier through its reuseIdentifier property.
- (Object) deselectRowAtIndexPath(indexPath, animated:animated)
Deselects a given row identified by index path, with an option to animate the deselection. Calling this method does not cause the delegate to receive a tableView:willSelectRowAtIndexPath: or tableView:didSelectRowAtIndexPath: message, nor will it send UITableViewSelectionDidChangeNotification notifications to observers.Calling this method does not cause any scrolling to the deselected row.
- (Object) endUpdates
Conclude a series of method calls that insert, delete, select, or reload rows and sections of the receiver. You call this method to bracket a series of method calls that began with beginUpdates and that consist of operations to insert, delete, select, and reload rows and sections of the table view. When you call endUpdates, UITableView animates the operations simultaneously. Invocations of beginUpdates and endUpdates can be nested. If you do not make the insertion, deletion, and selection calls inside this block, table attributes such as row count might become invalid.
- (UITableViewHeaderFooterView) footerViewForSection(section)
Returns the footer view associated with the specified section.
- (UITableViewHeaderFooterView) headerViewForSection(section)
Returns the header view associated with the specified section.
- (NSIndexPath) indexPathForCell(cell)
Returns an index path representing the row and section of a given table-view cell.
- (NSIndexPath) indexPathForRowAtPoint(point)
Returns an index path identifying the row and section at the given point.
- (NSIndexPath) indexPathForSelectedRow
Returns an index path identifying the row and section of the selected row. If there are multiple selections, this method returns the first index-path object in the array of row selections; this object has the lowest index values for section and row.
- (Array) indexPathsForRowsInRect(rect)
An array of index paths each representing a row enclosed by a given rectangle.
- (Array) indexPathsForSelectedRows
Returns the index paths represented the selected rows.
- (Array) indexPathsForVisibleRows
Returns an array of index paths each identifying a visible row in the receiver.
- (Object) initWithFrame(frame, style:style)
Initializes and returns a table view object having the given frame and style. You must specify the style of a table view when you create it and you cannot thereafter modify the style. If you initialize the table view with the UIView method initWithFrame:, the UITableViewStylePlain style is used as a default.
- (Object) insertRowsAtIndexPaths(indexPaths, withRowAnimation:animation)
Inserts rows in the receiver at the locations identified by an array of index paths, with an option to animate the insertion. UITableView calls the relevant delegate and data source methods immediately afterwards to get the cells and other content for visible cells.Note the behavior of this method when it is called in an animation block defined by the beginUpdates and endUpdates methods. UITableView defers any insertions of rows or sections until after it has handled the deletions of rows or sections. This happens regardless of ordering of the insertion and deletion method calls. This is unlike inserting or removing an item in a mutable array, where the operation can affect the array index used for the successive insertion or removal operation. For more on this subject, see “Batch Insertion and Deletion of Rows and Sections” in Table View Programming Guide for iOS.
- (Object) insertSections(sections, withRowAnimation:animation)
Inserts one or more sections in the receiver, with an option to animate the insertion. UITableView calls the relevant delegate and data source methods immediately afterwards to get the cells and other content for visible cells.Note the behavior of this method when it is called in an animation block defined by the beginUpdates and endUpdates methods. UITableView defers any insertions of rows or sections until after it has handled the deletions of rows or sections. This happens regardless of ordering of the insertion and deletion method calls. This is unlike inserting or removing an item in a mutable array, where the operation can affect the array index used for the successive insertion or removal operation. For more on this subject, see “Batch Insertion and Deletion of Rows and Sections” in Table View Programming Guide for iOS.
- (Object) moveRowAtIndexPath(indexPath, toIndexPath:newIndexPath)
Moves the row at a specified location to a destination location. You can combine row-move operations with row-insertion and row-deletion operations within a beginUpdates–endUpdates block to have all changes occur together as a single animation. Unlike the row-insertion and row-deletion methods, this method does not take an animation parameter. For rows that are moved, the moved row animates straight from the starting position to the ending postion. Also unlike the other methods, this method allows only one row to be moved per call. If you want multiple rows moved, you can call this method repeatedly within a beginUpdates–endUpdates block.
- (Object) moveSection(section, toSection:newSection)
Moves a section to a new location in the table view. You can combine section-move operations with section-insertion and section-deletion operations within a beginUpdates–endUpdates block to have all changes occur together as a single animation. Unlike the section-insertion section row-deletion methods, this method does not take an animation parameter. For sections that are moved, the moved section animates straight from the starting position to the ending postion. Also unlike the other methods, this method allows only one section to be moved per call. If you want multiple section moved, you can call this method repeatedly within a beginUpdates–endUpdates block.
- (Integer) numberOfRowsInSection(section)
Returns the number of rows (table cells) in a specified section. UITableView gets the value returned by this method from its data source and caches it.
- (Integer) numberOfSections
Returns the number of sections for the receiver. UITableView gets the value returned by this method from its data source and caches it.
- (CGRect) rectForFooterInSection(section)
Returns the drawing area for the footer of the specified section.
- (CGRect) rectForHeaderInSection(section)
Returns the drawing area for the header of the specified section.
- (CGRect) rectForRowAtIndexPath(indexPath)
Returns the drawing area for a row identified by index path.
- (CGRect) rectForSection(section)
Returns the drawing area for a specified section of the receiver.
- (Object) registerClass(cellClass, forCellReuseIdentifier:identifier)
Registers a class for use in creating new table cells. Prior to dequeueing any cells, call this method or the registerNib:forCellReuseIdentifier: method to tell the table view how to create new cells. If a cell of the specified type is not currently in a reuse queue, the table view uses the provided information to create a new cell object automatically.If you previously registered a class or nib file with the same reuse identifier, the class you specify in the cellClass parameter replaces the old entry. You may specify nil for cellClass if you want to unregister the class from the specified reuse identifier.
- (Object) registerClass(aClass, forHeaderFooterViewReuseIdentifier:identifier)
Registers a class for use in creating new table header or footer views. Prior to dequeueing any header or footer views, call this method or the registerNib:forHeaderFooterViewReuseIdentifier: method to tell the table view how to create new instances of your views. If a view of the specified type is not currently in a reuse queue, the table view uses the provided information to create a one automatically.If you previously registered a class or nib file with the same reuse identifier, the class you specify in the cellClass parameter replaces the old entry. You may specify nil for cellClass if you want to unregister the class from the specified reuse identifier.
- (Object) registerNib(nib, forCellReuseIdentifier:identifier)
Registers a nib object containing a cell with the table view under a specified identifier. Prior to dequeueing any cells, call this method or the registerClass:forCellReuseIdentifier: method to tell the table view how to create new cells. If a cell of the specified type is not currently in a reuse queue, the table view uses the provided information to create a new cell object automatically. If you previously registered a class or nib file with the same reuse identifier, the nib you specify in the nib parameter replaces the old entry. You may specify nil for nib if you want to unregister the nib from the specified reuse identifier.
- (Object) registerNib(nib, forHeaderFooterViewReuseIdentifier:identifier)
Registers a nib object containing a header or footer with the table view under a specified identifier. Prior to dequeueing any header or footer views, call this method or the registerClass:forHeaderFooterViewReuseIdentifier: method to tell the table view how to create new instances of your views. If a view of the specified type is not currently in a reuse queue, the table view uses the provided information to create a new one automatically. If you previously registered a class or nib file with the same reuse identifier, the nib you specify in the nib parameter replaces the old entry. You may specify nil for nib if you want to unregister the nib from the specified reuse identifier.
- (Object) reloadData
Reloads the rows and sections of the receiver. Call this method to reload all the data that is used to construct the table, including cells, section headers and footers, index arrays, and so on. For efficiency, the table view redisplays only those rows that are visible. It adjusts offsets if the table shrinks as a result of the reload. The table view’s delegate or data source calls this method when it wants the table view to completely reload its data. It should not be called in the methods that insert or delete rows, especially within an animation block implemented with calls to beginUpdates and endUpdates
- (Object) reloadRowsAtIndexPaths(indexPaths, withRowAnimation:animation)
Reloads the specified rows using a certain animation effect. Reloading a row causes the table view to ask its data source for a new cell for that row. The table animates that new cell in as it animates the old row out. Call this method if you want to alert the user that the value of a cell is changing. If, however, notifying the user is not important—that is, you just want to change the value that a cell is displaying—you can get the cell for a particular row and set its new value.When this method is called in an animation block defined by the beginUpdates and endUpdates methods, it behaves similarly to deleteRowsAtIndexPaths:withRowAnimation:. The indexes that UITableView passes to the method are specified in the state of the table view prior to any updates. This happens regardless of ordering of the insertion, deletion, and reloading method calls within the animation block.
- (Object) reloadSectionIndexTitles
Reloads the items in the index bar along the right side of the table view. This method gives you a way to update the section index after inserting or deleting sections without having to reload the whole table.
- (Object) reloadSections(sections, withRowAnimation:animation)
Reloads the specified sections using a given animation effect. Calling this method causes the table view to ask its data source for new cells for the specified sections. The table view animates the insertion of new cells in as it animates the old cells out. Call this method if you want to alert the user that the values of the designated sections are changing. If, however, you just want to change values in cells of the specified sections without alerting the user, you can get those cells and directly set their new values.When this method is called in an animation block defined by the beginUpdates and endUpdates methods, it behaves similarly to deleteSections:withRowAnimation:. The indexes that UITableView passes to the method are specified in the state of the table view prior to any updates. This happens regardless of ordering of the insertion, deletion, and reloading method calls within the animation block.
- (Object) scrollToNearestSelectedRowAtScrollPosition(scrollPosition, animated:animated)
Scrolls the table view so that the selected row nearest to a specified position in the table view is at that position.
- (Object) scrollToRowAtIndexPath(indexPath, atScrollPosition:scrollPosition, animated:animated)
Scrolls the receiver until a row identified by index path is at a particular location on the screen. Invoking this method does not cause the delegate to receive a scrollViewDidScroll: message, as is normal for programmatically-invoked user interface operations.
- (Object) selectRowAtIndexPath(indexPath, animated:animated, scrollPosition:scrollPosition)
Selects a row in the receiver identified by index path, optionally scrolling the row to a location in the receiver. Calling this method does not cause the delegate to receive a tableView:willSelectRowAtIndexPath: or tableView:didSelectRowAtIndexPath: message, nor will it send UITableViewSelectionDidChangeNotification notifications to observers.
- (Object) setEditing(editing, animated:animate)
Toggles the receiver into and out of editing mode. When you call this method with the value of editing set to YES, the table view goes into editing mode by calling setEditing:animated: on each visible UITableViewCell object. Calling this method with editing set to NO turns off editing mode. In editing mode, the cells of the table might show an insertion or deletion control on the left side of each cell and a reordering control on the right side, depending on how the cell is configured. (See UITableViewCell Class Reference for details.) The data source of the table view can selectively exclude cells from editing mode by implementing tableView:canEditRowAtIndexPath:.
- (Array) visibleCells
Returns the table cells that are visible in the receiver.