Uitableviewdatasource the methods that must be followed

Source: Internet
Author: User


-Tableview:cellforrowatindexpath:

Required
asks the data source for a cell to insert a particular location of the table view. (required)//Request a cell data from the data source to insert into the table view

Declaration Declaration
SWIFT
        func TableView (_ Tableview:uitableview,
Cellforrowatindexpath Indexpath:nsindexpath), UITableViewCell
Objective-c
-(UITableViewCell *) TableView: (UITableView *) TableView
         Cellforrowatindexpath: ( Nsindexpath *) indexpath
Parameters Parameters
tableview   
A Table-view Object requesting the cell.// A table View object requests a cell
Indexpath index path    
An index path locating a row in tableview.//a row of data in a table view
Return Value
An object inheriting inherits from UITableViewCell, the table view can use for the specified row. An assertion are raised if you return nil.

Discussion
The returned UITableViewCell object is frequently one, the application reuses for performance reasons. You should fetch a previously created Cell object this is marked for reuse by sending a dequeuereusablecellwithidentifier: Message to TableView. Various attributes of a table cell was set automatically based on whether the cell was a separator and on information the D ATA source provides, such as for accessory views and editing controls.

Import Statement
Objective-c
@import UIKit;
SWIFT
Import UIKit


-Tableview:numberofrowsinsection:

Required
Tells the data source to return the number of rows in a given section of a table view. (required)//returns the number of rows

Declaration statement
SWIFT
Func TableView (_ Tableview:uitableview,
Numberofrowsinsection section:int)-Int
Objective-c
-(Nsinteger) TableView: (UITableView *) TableView
Numberofrowsinsection: (Nsinteger) Section
Parameters parameters
TableView
The Table-view object requesting this information.
Section
An index number identifying a section in TableView.
Return Value
The number of rows in a section.

Import Statement
Objective-c
@import UIKit;
SWIFT
Import UIKit

Uitableviewdatasource the methods that must be followed

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.