Archived
Added strikethroughs to room strings if they contain "?"
This commit is contained in:
@@ -84,13 +84,20 @@ class PlanViewController : UIViewController, UICollectionViewDataSource, UIColle
|
||||
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: identifier, for: indexPath as IndexPath) as! PlanViewCell
|
||||
cell.group.text = self.substs[indexPath.item].group
|
||||
cell.additional.text = self.substs[indexPath.item].additional
|
||||
cell.date.text = self.substs[indexPath.item].date
|
||||
cell.time.text = self.substs[indexPath.item].time
|
||||
cell.room.text = self.substs[indexPath.item].room
|
||||
cell.date.text = self.substs[indexPath.item].date
|
||||
|
||||
let course = self.substs[indexPath.item].course
|
||||
let image = df.getImage(from: course)
|
||||
|
||||
let roomMutable = NSMutableAttributedString(string: self.substs[indexPath.item].room)
|
||||
let room = self.substs[indexPath.item].room
|
||||
if let qmark = room.firstIndex(of: "?") {
|
||||
let distance = room.distance(from: room.startIndex, to: qmark)
|
||||
roomMutable.addAttribute(NSAttributedString.Key.strikethroughStyle, value: 2, range: NSMakeRange(0, distance))
|
||||
}
|
||||
cell.room.attributedText = roomMutable
|
||||
|
||||
if image != nil {
|
||||
let attachment: NSTextAttachment = NSTextAttachment()
|
||||
attachment.bounds = CGRect(x: 0, y: 0, width: 16, height: 16)
|
||||
|
||||
Reference in New Issue
Block a user