-
Notifications
You must be signed in to change notification settings - Fork 0
/
TwitterPhotoCellController.swift
93 lines (73 loc) · 3.56 KB
/
TwitterPhotoCellController.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
93
//
// TwitterPhotoCellController.swift
// comblie
//
// Created by Cal on 10/24/15.
// Copyright © 2015 Comblie. All rights reserved.
//
import UIKit
class TwitterPhotoCellController: UITableViewCell {
var parent : UITableViewController!
@IBOutlet weak var postBackgroundImage: UIImageView!
@IBOutlet weak var profileImage: UIImageView!
@IBOutlet weak var postText: UILabel!
@IBOutlet weak var statusText: UILabel!
@IBOutlet weak var lineHeight: NSLayoutConstraint!
@IBOutlet weak var lineSeparator: UIView!
var VC : CommentsController!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
//self.postBackgroundImage.image = UIImage(named: "vinebackground")
self.profileImage.layer.cornerRadius = CGFloat(self.profileImage.frame.height/2)
configureText()
lineHeight.constant = CGFloat(0.5)
}
override func setSelected(selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
lineSeparator.backgroundColor = UIColor.whiteColor()
// Configure the view for the selected state
}
override func setHighlighted(highlighted: Bool, animated: Bool) {
lineSeparator.backgroundColor = UIColor.whiteColor()
}
//MARK: Actions
@IBAction func enlarge(sender: UIButton) {
VC = self.window?.rootViewController?.storyboard?.instantiateViewControllerWithIdentifier("Comments") as! CommentsController
VC.postHeight = self.contentView.frame.height
self.window?.rootViewController?.presentViewController(VC, animated: true, completion: nil)
UIApplication.sharedApplication().statusBarStyle = UIStatusBarStyle.Default
}
func configureText() {
var user = "Smith "
var userMutableString = NSMutableAttributedString()
userMutableString = NSMutableAttributedString(string: user, attributes: [NSFontAttributeName:UIFont(
name: "HelveticaNeueLTStd-Roman",
size: 10.0)!])
var sectionOne = "retweeted "
var sectionOneMutableString = NSMutableAttributedString()
sectionOneMutableString = NSMutableAttributedString(string: sectionOne, attributes: [NSFontAttributeName:UIFont(
name: "HelveticaNeueLTStd-Lt",
size: 10.0)!])
var author = "Johnny"
var authorMutableString = NSMutableAttributedString()
authorMutableString = NSMutableAttributedString(string: author, attributes: [NSFontAttributeName:UIFont(
name: "HelveticaNeueLTStd-Roman",
size: 10.0)!])
var sectionTwo = "'s post on "
var sectionTwoMutableString = NSMutableAttributedString()
sectionTwoMutableString = NSMutableAttributedString(string: sectionTwo, attributes: [NSFontAttributeName:UIFont(
name: "HelveticaNeueLTStd-Lt",
size: 10.0)!])
var network = "Twitter"
var networkMutableString = NSMutableAttributedString()
networkMutableString = NSMutableAttributedString(string: network, attributes: [NSFontAttributeName:UIFont(
name: "HelveticaNeueLTStd-Roman",
size: 10.0)!])
userMutableString.appendAttributedString(sectionOneMutableString)
userMutableString.appendAttributedString(authorMutableString)
userMutableString.appendAttributedString(sectionTwoMutableString)
userMutableString.appendAttributedString(networkMutableString)
statusText.attributedText = userMutableString
}
}