2 Ocak 2015 Cuma

Custom tableviewcell iOS Development in Swift


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: UIViewControllerUITableViewDelegateUITableViewDataSource{

    @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