Commit 05861425 authored by tayathorn's avatar tayathorn
Browse files

Merge branch 'feature/sprint32_FixBug' into develop

Showing with 33 additions and 7 deletions
+33 -7
......@@ -46,14 +46,35 @@ extension UIViewController {
extension String {
//MARK: Calculate content size
func getContentTextFitSize(width widthSize : CGFloat) -> CGSize{
let contentTextView = UITextView(frame: CGRect(origin: CGPointZero, size: CGSize(width: widthSize, height: CGFloat(MAXFLOAT))))
func getContentTextFitSize(width widthSize : CGFloat, edgeInset : UIEdgeInsets) -> CGSize{
let contentTextView = JTMTextView(frame: CGRect(origin: CGPointZero, size: CGSize(width: widthSize, height: CGFloat(MAXFLOAT))))
contentTextView.font = getFontFromDeviceSize()
contentTextView.text = self
contentTextView.textContainerInset = UIEdgeInsets(top: 10, left: 16, bottom: 10, right: 5)
dump(self)
// contentTextView.setLineSpacingText(self)
contentTextView.textContainerInset = edgeInset
let contentSize = contentTextView.sizeThatFits(CGSize(width: UIScreen.mainScreen().bounds.width, height: CGFloat(MAXFLOAT)))
let contentSize = contentTextView.sizeThatFits(CGSize(width: widthSize, height: CGFloat(MAXFLOAT)))
return contentSize
return contentSize//CGSizeMake(UIScreen.mainScreen().bounds.width, 400)
}
func getFontFromDeviceSize() -> UIFont {
var fontSize : CGFloat = 0
if screenType == DisplaySizeType.SCREEN_3_5_INCH {
fontSize = 12
} else if screenType == DisplaySizeType.SCREEN_4_0_INCH {
fontSize = 12
} else if screenType == DisplaySizeType.SCREEN_4_7_INCH {
fontSize = 13
} else if screenType == DisplaySizeType.SCREEN_5_5_INCH {
fontSize = 14
} else {
fontSize = 12
}
return UIFont(name: "HelveticaNeue", size: fontSize)!
}
func addHttpToUrl() -> String {
......
......@@ -10,8 +10,13 @@ import UIKit
class JTMTextView : UITextView {
override init(frame: CGRect, textContainer: NSTextContainer?) {
super.init(frame: frame, textContainer: textContainer)
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
func setLineSpacingText(text: String) {
......
......@@ -39,8 +39,8 @@ class NoticeModel {
//MARK: Calculate Content Size
func getContentHeight(text : String) -> CGFloat{
let contentWidth = UIScreen.mainScreen().bounds.width - contentEdgeInset.left - contentEdgeInset.right
return text.getContentTextFitSize(width: contentWidth).height
let contentWidth = UIScreen.mainScreen().bounds.width// - contentEdgeInset.left - contentEdgeInset.right
return text.getContentTextFitSize(width: contentWidth, edgeInset: contentEdgeInset).height
}
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment