-
Notifications
You must be signed in to change notification settings - Fork 0
/
PostItems.swift
92 lines (68 loc) · 2.98 KB
/
PostItems.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
//
// PostItems.swift
// KallerRadar
//
// Created by Kuli Gabor on 2015. 05. 22..
// Copyright (c) 2015. kebodev. All rights reserved.
//
import UIKit
class PostItems: UIView {
var labelText : String!
var labelHeader : String!
var outView : UIView!
init(labelText: String , labelHeader: String) {
super.init(frame: CGRectMake(0, 0, 1, 1))
self.labelText = labelText
self.labelHeader = labelHeader
self.setTranslatesAutoresizingMaskIntoConstraints(false)
setupContent()
}
required init(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
println("required public")
}
private func setupContent(){
println("setupContent fut nem a forban")
/*
for v in subviews{
println("setupContent fut for ciklusban")
v.removeFromSuperview()
}
*/
self.outView = blockForTimeFrame()
addSubview(blockForTimeFrame())
}
private func blockForTimeFrame() -> UIView{
let viewNew = UIView()
viewNew.setTranslatesAutoresizingMaskIntoConstraints(false)
let titleLabel = UILabel()
titleLabel.setTranslatesAutoresizingMaskIntoConstraints(false)
titleLabel.font = UIFont(name: "ArialMT", size: 20)
titleLabel.textColor = UIColor.blackColor()
titleLabel.text = labelHeader
titleLabel.numberOfLines = 0
titleLabel.layer.masksToBounds = false
viewNew.addSubview(titleLabel)
viewNew.addConstraints([
NSLayoutConstraint(item: titleLabel, attribute: .Width, relatedBy: .Equal, toItem: viewNew, attribute: .Width, multiplier: 1.0, constant: 0),
NSLayoutConstraint(item: titleLabel, attribute: .Left, relatedBy: .Equal, toItem: viewNew, attribute: .Left, multiplier: 1.0, constant: 0),
NSLayoutConstraint(item: titleLabel, attribute: .Top, relatedBy: .Equal, toItem: viewNew, attribute: .Top, multiplier: 1.0, constant: 0)
])
/*
let textLabel = UILabel()
textLabel.setTranslatesAutoresizingMaskIntoConstraints(false)
textLabel.font = UIFont(name: "ArialMT", size: 16)
textLabel.text = labelText
textLabel.textColor = UIColor.blackColor()
textLabel.numberOfLines = 0
textLabel.layer.masksToBounds = false
v.addSubview(textLabel)
v.addConstraints([
NSLayoutConstraint(item: textLabel, attribute: .Width, relatedBy: .Equal, toItem: v, attribute: .Width, multiplier: 1.0, constant: 0),
NSLayoutConstraint(item: textLabel, attribute: .Left, relatedBy: .Equal, toItem: v, attribute: .Left, multiplier: 1.0, constant: 0),
NSLayoutConstraint(item: textLabel, attribute: .Top, relatedBy: .Equal, toItem: titleLabel, attribute: .Bottom, multiplier: 1.0, constant: 5)
])
*/
return viewNew
}
}