-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAETableViewCell.swift
More file actions
77 lines (58 loc) · 2.21 KB
/
AETableViewCell.swift
File metadata and controls
77 lines (58 loc) · 2.21 KB
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
//
// AETableViewCell.swift
// Æffect
//
// Created by Joshua O'Steen on 3/20/15.
// Copyright (c) 2015 Josh O'Steen. All rights reserved.
//
import UIKit
class AETableViewCell: UITableViewCell {
@IBOutlet weak var emotionColor: UIView!
@IBOutlet weak var featuredImage: UIImageView!
@IBOutlet weak var headline: UILabel!
@IBOutlet weak var author: UILabel!
@IBOutlet weak var pubDate: UILabel!
weak var tableView : UITableView?
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
override func setEditing(editing: Bool, animated: Bool) {
super.setEditing(editing, animated: animated)
// remove disclosure indicator when entering edit mode
if editing {
self.accessoryType = .None
} else { // add disclosure indicator
self.accessoryType = .DisclosureIndicator
}
}
// edit selection marker for for each cell to center marker in extra margin that is revealed when in editing mode
override func didTransitionToState(state: UITableViewCellStateMask) {
super.layoutSubviews()
UIView.beginAnimations(nil, context: nil)
UIView.setAnimationBeginsFromCurrentState(false)
UIView.setAnimationDuration(0.0)
if let parentTableView = self.tableView as UITableView? {
if parentTableView.editing {
var contentFrame : CGRect = self.contentView.frame
contentFrame.origin.x = 51.0
self.contentView.frame = contentFrame
}
}
UIView.commitAnimations()
}
override func layoutSubviews() {
super.layoutSubviews()
if let parentTableView = self.tableView as UITableView? {
if parentTableView.editing {
var contentFrame : CGRect = self.contentView.frame
contentFrame.origin.x = 51.0
self.contentView.frame = contentFrame
}
}
}
}