Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // MyCell.swift
- // tableViewSwift
- //
- // Created by Kaushik Das on 7/17/14.
- // Copyright (c) 2014 Kaushik Das. All rights reserved.
- //
- import Foundation
- import UIKit
- class MyCell: UITableViewCell{
- @IBOutlet var cellMyImage: UIImageView
- @IBOutlet var cellMyCity: UILabel
- @IBOutlet var cellMyCountry: UILabel
- init(style: UITableViewCellStyle, reuseIdentifier: String!) {
- super.init(style: style, reuseIdentifier: reuseIdentifier)
- }
- override func awakeFromNib() {
- super.awakeFromNib()
- }
- override func setSelected(selected: Bool, animated: Bool) {
- super.setSelected(selected, animated: animated)
- }
- }
- //
- // ViewController.swift
- // tableViewSwift
- //
- // Created by Kaushik Das on 7/17/14.
- // Copyright (c) 2014 Kaushik Das. All rights reserved.
- //
- import UIKit
- class ViewController: UITableViewController {
- override func viewDidLoad() {
- super.viewDidLoad()
- // Do any additional setup after loading the view, typically from a nib.
- }
- override func didReceiveMemoryWarning() {
- super.didReceiveMemoryWarning()
- // Dispose of any resources that can be recreated.
- }
- override func numberOfSectionsInTableView(tableView: UITableView!) -> Int {
- return 1
- }
- override func tableView(tableView: UITableView?, numberOfRowsInSection section: Int) -> Int {
- return 10
- }
- override func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath:NSIndexPath!) -> UITableViewCell! {
- let kCellIdentifier:String = "MyCell"
- var cell = tableView.dequeueReusableCellWithIdentifier(kCellIdentifier) as MyCell!
- if cell == nil {
- // register Custom UITableView Class to UITableView
- tableView.registerClass(MyCell.classForCoder(), forCellReuseIdentifier: kCellIdentifier)
- cell = MyCell(style: UITableViewCellStyle.Default, reuseIdentifier: kCellIdentifier)
- }
- cell.cellMyCity.text="test city"
- cell.cellMyCountry.text="test country"
- return cell
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement