Category Archives: Uncategorized

View

create a customView Subclass at first
click File from Manu -> New -> File
and flow downCode

import UIKit

@IBDesignable

class customView: UIView {

  override func draw(_ rect: CGRect) {  

// indicate for borderline

    layer.borderWidth = 10.0

  }
}

put view by dragging from object library, 
select view and works in pin.
put 20 spacing to nearest neighbor.
unselect constraint to margins
in update frames select items of new constraints.
add 4 constraints

note : if you find some red color  view
resolve auto layout issues
click -> all views in view controller -> Update Frames
Note: if find something wrong 
click -> all views in view controller -> Clear Constraints

in Identity inspector, class change to customView
Note : if you can change anything
click -> product from manu -> Clean 
again click -> product -> build

screen-shot-2016-12-01-at-7-42-53-am
Advertisements

Table View with Number List

// Created by Mohammad Azmal Hossain on 11/22/16.
// Copyright © 2016 Mohammad Azmal Hossain. All rights reserved.
//

import UIKit

class ViewController: UIViewController, UITableViewDataSource {

 func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
 return 10
 }
 func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
 let cell = UITableViewCell()
 cell.textLabel!.text = "this is row \(indexPath.row)"
 return cell
 }
 
 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.
 }


}