Tags » Tableview

Table View Part-3

import UIKit
class ViewController: UIViewController, UITableViewDataSource {
let dailyTask = [ "Check all windows", "check all doors", "check temperature of freezer","check the mailBox at at the end fo the lane","empty trash containers","if freezing, check water popes outside"]
 let weeklyTasks = ["check inside all unoccupied cabins", "run all faucets for 30 seconds","Walk the perimeter of property", "Arrange for dumpster pickup"]
 let twoWeekTasks = ["Run test on security alarm","check all motion detectors","Test smoke alarms"]
 func numberOfSections(in tableView: UITableView) -> Int {
 return 3 // declared 3 array formar
 }
 func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
 switch section {
 case 0:
 return dailyTask.count
 case 1:
 return weeklyTasks.count
 case 2:
 return twoWeekTasks.count
 default:
 return 0
 }
 }
 func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
 let cell = UITableViewCell()
 var currentTask : String
 switch indexPath.section {
 case 0:
 currentTask = dailyTask
 case 1 :
 currentTask = weeklyTasks
 case 2:
 currentTask = twoWeekTasks
 default:
 currentTask = ""
 }
 cell.textLabel!.text = currentTask
 return cell
 }
 func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? 54 more words
TableView

Table View Part-2

// Created by MohammadAzmalHossain on 11/19/16.


import UIKit

class ViewController: UIViewController, UITableViewDataSource {
 let devCourse = [("ios app development with swift training","simon allardice"),("ios 8 SDK new features","Lee BrimeLow"),("Data visualization with D3.js","Ray Villaglobos"),("swift essential training","simon allardice"),("Up and Running with AngularJS","Dan Gookin"),("MySQL Essential Training","Scott Simpson"),("Building Adaptive andraid apps with franments","David Gassner")]
 func numberOfSections(in tableView: UITableView) -> Int {
 return 1
 }
 func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
 return devCourse.count
 }
 func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
 let cell = UITableViewCell()
 let (courseTitle, courseAuthor) = devCourse
 cell.textLabel?.text = courseTitle
 return cell
 
 
 }
 
 
 override func viewDidLoad() {
 super.viewDidLoad()
 // Do any additional setup after loading the view, typically from a nib. 15 more words
TableView

Table View

// Created by MohammadAzmalHossain on 11/19/16.
import UIKit
class ViewController: UIViewController, UITableViewDataSource {
 func numberOfSections(in tableView: UITableView) -> Int {
 return 1
 }
 func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
 return 5
 }
 func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
 let cell = UITableViewCell()
 cell.textLabel?.text = "Hello World"
 return cell
 }
 
 
 override func viewDidLoad() {
 super.viewDidLoad()
 // Do any additional setup after loading the view, typically from a nib. 13 more words
TableView

Custom TableView in Swift in iOS

Today we will learn how to make a simple custom tableview in ios using Xcode8 and swift 3

Steps 1:

  1. Create a new xcode project Lets say(CustomTableViewiniOSinSwift)
  2. 334 more words
Swift

A Simple TableView example in Swift iOS

Hi Friends, Earlier we learnt how to create tableView in iOS using objective C. Today we

will learn how to create a simple tableView in iOS using Swift. 175 more words

IOS