Skip to content

Commit

Permalink
Merge pull request johnlui#50 from zzjzz9266a/swift3
Browse files Browse the repository at this point in the history
adjust the size of label if text is too long
  • Loading branch information
johnlui authored Jun 2, 2017
2 parents 2888db9 + 7c43616 commit a335414
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion SwiftNotice.swift
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,8 @@ class SwiftNotice: NSObject {
label.font = UIFont.systemFont(ofSize: 13)
label.textAlignment = NSTextAlignment.center
label.textColor = UIColor.white
label.sizeToFit()
let size = label.sizeThatFits(CGSize(width: UIScreen.main.bounds.width-82, height: CGFloat.greatestFiniteMagnitude))
label.bounds = CGRect(x: 0, y: 0, width: size.width, height: size.height)
mainView.addSubview(label)

let superFrame = CGRect(x: 0, y: 0, width: label.frame.width + 50 , height: label.frame.height + 30)
Expand Down

0 comments on commit a335414

Please sign in to comment.