1. Class의 UIViewController 옆에 ,UITableViewDataSource, UITableViewDelegate 추가
2.다음 함수들 삽입
func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 1
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return leftMenu.count
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = self.tableView.dequeueReusableCellWithIdentifier("leftCell", forIndexPath: indexPath) as! LeftTableViewCell
let row = indexPath.row
cell.cellTitle.text = leftMenu[row]
// Configure the cell...
return cell
}
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
// cell selected code here
}
3. ViewDidLoad에 다음을 추가
tableView.delegate = self
tableView.dataSource = self
'IOS > Swift' 카테고리의 다른 글
Swift의 Type checking (0) | 2016.05.07 |
---|---|
String형식으로 응답받은 String Array를 String으로 만들기 (0) | 2016.02.27 |
Segue의 정리 (0) | 2016.02.25 |
1개의 UIViewController에 2개의 TableViewController 넣기 (0) | 2016.02.22 |
Modal이나 Alert 띄울때 반투명 백그라운드 (0) | 2016.02.22 |
댓글 로드 중…
트랙백을 확인할 수 있습니다
URL을 배껴둬서 트랙백을 보낼 수 있습니다