Contents

Develop
2014.01.09 14:19

[ios] UIButton multi-line iOS7

조회 수 11431 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
예전에 멀티라인 버튼을 아래처럼 작성했던게..
button.titleLabel.lineBreakMode = UILineBreakModeWordWrap;
button.titleLabel.textAlignment = UITextAlignmentCenter;
[button setTitle: @"Line1\nLine2" forState: UIControlStateNormal];

iOS6 에서 UILineBreakModeWordWrap, UITextAlignmentCenter 이게 deprecated 됨..
그래서.. 이렇게~
button.titleLabel.lineBreakMode = NSLineBreakByWordWrapping;
button.titleLabel.textAlignment = NSTextAlignmentCenter;
[button setTitle: @"Line1\nLine2" forState: UIControlStateNormal];

Background, Text, Multi-Line 샘플..
_button = [UIButton buttonWithType:UIButtonTypeCustom];
_button.frame = CGRectMake(buttonWidth*1, 65, buttonWidth, 43);
_button.titleLabel.font = [UIFont systemFontOfSize:12];
_button.titleLabel.lineBreakMode = NSLineBreakByWordWrapping;
_button.titleLabel.textAlignment = NSTextAlignmentCenter;

[_button setTitle:@"라인1\n라인2" forState:UIControlStateNormal];

[_button setTitleColor:[UIColor
    colorWithRed:153/255.0
    green:153/255.0
    blue:153/255.0 alpha:1.0] forState:UIControlStateNormal];

[_button setTitleColor:[UIColor
    colorWithRed:81/255.0
    green:19/255.0
    blue:137/255.0 alpha:1.0] forState:UIControlStateSelected];

[_button setBackgroundImage:
    [UIImage imageNamed:@"06_setting_category_tab_n"]
    forState:UIControlStateNormal];

[_button setBackgroundImage:
    [UIImage imageNamed:@"06_setting_category_tab_s"]
    forState:UIControlStateSelected];

[_button addTarget:self
    action:@selector(_buttonAction:)
    forControlEvents:UIControlEventTouchUpInside];

[self.view addSubview:_button];


?

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
345 Database [oracle] SQL문 실행 방법 3가지 file hooni 2013.12.19 12115
344 Develop [css] z-index에 설정할 수 있는 최대값? hooni 2013.12.20 14275
343 Develop [js] jQuery plugin 요약 hooni 2013.12.20 10696
342 System/OS [linux] CentOS 터미널 언어 설정(한글/영어) hooni 2013.12.22 18508
341 System/OS [linux] root 전환시 패스워드 없이 su 사용하기 hooni 2013.12.22 12680
340 Develop [php] GregorianToJD(), JDToGregorian() 함수 내용 hooni 2013.12.25 10589
339 Develop [php] 하루 전 날짜 쉽게 구하기. hooni 2013.12.25 12187
338 Etc [용어] POC, Pilot, BMT에 대한 IT 업계에서 통용되는 의미 hooni 2014.01.02 41944
337 Develop [js] AngularJS를 소개합니다. file hooni 2014.01.06 13010
336 Etc iOS 에서 쓸만한 오프라인 구글지도 찾기 hooni 2014.01.06 16030
» Develop [ios] UIButton multi-line iOS7 hooni 2014.01.09 11431
334 System/OS [linux] iconv를 이용하여 euc-kr 문서를 utf-8로 대량으로 변환하기 file hooni 2014.01.09 12214
Board Pagination Prev 1 ... 65 66 67 68 69 70 71 72 73 74 ... 98 Next
/ 98