Custom tableviewcell example is developed for Swift language.
An examle for Custom tableviewcell in mobile development
Create a new project
Choose swift language
Add a table view and TableView Delegate and DataSource protocols in ViewController
class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource{
@IBOutlet var tableView: UITableView!
...
Add items and ids for cell
var items: [String] = ["Title1", "Title2", "Title3"]
var subItems: [String] = ["SubTitle1", "SubTitle2", "SubTitle3"]
var itemIds:[Int] = []
After we implements tableview methods in the ViewController Class
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
}
func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath)-> CGFloat
{
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
}
Result
You can download example project from Github
Hiç yorum yok:
Yorum Gönder