[iOS] swift 3.x : UILabel 높이 자동 맞춤


UILabel autosize height

외부 UIView에 Constraints 추가
사용자 삽입 이미지


UILabel에 Constranints 추가 및 Lines 0으로 설정
사용자 삽입 이미지



결과

사용자 삽입 이미지


전체소스 : labelAutoHeight.zip

Posted by incree

2017/01/24 21:29 2017/01/24 21:29
, , ,
Response
0 Trackbacks , 0 Comments
RSS :
http://www.incree.com/tc/incree/rss/response/375

Trackback URL : 이 글에는 트랙백을 보낼 수 없습니다

UILabel multiple attributes, UILabel strikethrough text



letstyle1: [String:Any] = [NSForegroundColorAttributeName:UIColor.darkGray,NSFontAttributeName:UIFont.systemFont(ofSize:12),NSStrikethroughStyleAttributeName:NSUnderlineStyle.styleSingle.rawValue,NSStrikethroughColorAttributeName:UIColor.cyan]
       
     
let style2: [String: Any] = [NSForegroundColorAttributeName: UIColor.red, NSFontAttributeName: UIFont(name: "Georgia", size: 25.0)!]
     
     
let style3: [String: Any] = [NSForegroundColorAttributeName: UIColor.blue, NSBackgroundColorAttributeName: UIColor.yellow, NSFontAttributeName: UIFont.boldSystemFont(ofSize: 13), NSUnderlineStyleAttributeName : NSUnderlineStyle.styleSingle.rawValue]
     
     
let style1Text = "회색 12폰트 취소선 cyan"
     
let style2Text = "빨간색 25폰트 폰트지정"
     
let style3Text = "파란색 13폰트 볼드 밑줄 배경 노랑"
     
     
let style1String = NSMutableAttributedString(string: style1Text, attributes: style1)
     
let style2String = NSMutableAttributedString(string: style2Text, attributes: style2)
     
let style3String = NSMutableAttributedString(string: style3Text, attributes: style3)
     
       style1String.
append(style2String)
       style1String.
append(style3String)
     

        lblMultiFontStyle.attributedText = style1String












/**
 * swift 2.x
let style1: [String : AnyObject] = [
                    NSForegroundColorAttributeName: UIColor.darkGrayColor(),
                    NSFontAttributeName: UIFont.systemFontOfSize(12),
                    NSStrikethroughStyleAttributeName: NSUnderlineStyle.StyleSingle.rawValue]
                let style2: [String : AnyObject] = [
                    NSForegroundColorAttributeName: UIColor.blackColor(),
                    NSFontAttributeName: UIFont.systemFontOfSize(12)]
                let style3: [String : AnyObject] = [
                    NSForegroundColorAttributeName: ColorUtil.hexStringToUIColor("#AF0A2B"),
                    NSFontAttributeName: UIFont.boldSystemFontOfSize(13)]

                let style1Text = "첫번째 12폰트 취소선 회색"
                let style2Text  = "두번째 12폰트 검은색"
                let style3Text = "세번째 볼드 13폰트 컬러 : AF0A2B"

                let style1String = NSMutableAttributedString(string: style1Text, attributes: style1)
                let style2String = NSMutableAttributedString(string: style2Text, attributes: style2)
                let style3String = NSMutableAttributedString(string: style3Text, attributes: style3)

                style1String.appendAttributedString(style2String)
                style1String.appendAttributedString(style3String)
                lblMultiFontStyle.attributedText = style1String
*/


사용자 삽입 이미지

전체소스 : multiFontStye.zip

Posted by incree

2017/01/24 21:13 2017/01/24 21:13
, ,
Response
0 Trackbacks , 0 Comments
RSS :
http://www.incree.com/tc/incree/rss/response/374

Trackback URL : 이 글에는 트랙백을 보낼 수 없습니다

Swift Cookie sharing between multiple WKWebViews

https://github.com/ShingoFukuyama/WKWebViewTips

self.processPool = [[WKProcessPool alloc] init];

WKWebViewConfiguration *configuration1 = [[WKWebViewConfiguration alloc] init];
configuration1.processPool = self.processPool;
WKWebView *webView1 = [[WKWebView alloc] initWithFrame:CGRectZero configuration:configuration1];
...
WKWebViewConfiguration *configuration2 = [[WKWebViewConfiguration alloc] init];
configuration2.processPool = self.processPool;
WKWebView *webView2 = [[WKWebView alloc] initWithFrame:CGRectZero configuration:configuration2];

Posted by incree

2016/04/21 20:54 2016/04/21 20:54
, , , , ,
Response
0 Trackbacks , 0 Comments
RSS :
http://www.incree.com/tc/incree/rss/response/366

Trackback URL : 이 글에는 트랙백을 보낼 수 없습니다


Notices

Archives

Authors

  1. incree

Recent Trackbacks

Calendar

«   2017/02   »
      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        

Site Stats

Total hits:
389671
Today:
6
Yesterday:
144