Constraint 동적 추가
iOS/XCode Swift반응형
self.myTableView.translatesAutoresizingMaskIntoConstraints = false
self.view.addConstraint(NSLayoutConstraint(item: self.myTableView,
attribute: .top, relatedBy: .equal, toItem: self.view, attribute: .top,
multiplier: 1.0, constant: 0))
self.view.addConstraint(NSLayoutConstraint(item: self.myTableView,
attribute: .bottom, relatedBy: .equal, toItem: self.view,
attribute: .bottom, multiplier: 1.0, constant: 0))
self.view.addConstraint(NSLayoutConstraint(item: self.myTableView,
attribute: .leading, relatedBy: .equal, toItem: self.view,
attribute: .leading, multiplier: 1.0, constant: 0))
참고 : https://magi82.github.io/implement-uitableview-programmatically-in-swift/
반응형
'iOS > XCode Swift' 카테고리의 다른 글
동적으로 NavigationBar 와 TableView 추가.code (0) | 2018.05.18 |
---|---|
Status Bar 숨기기 (Carrier/ Wifi/ BatteryIcon Bar) (0) | 2018.05.18 |
CommonLib.swift (0) | 2018.05.17 |
Class 정의 (0) | 2018.05.16 |
애플 Swift Standard Library (0) | 2018.05.16 |