Contents

Develop
2014.01.09 14:19

[ios] UIButton multi-line iOS7

Views 11435 Comment 0
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
예전에 멀티라인 버튼을 아래처럼 작성했던게..
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];


?

  1. [oracle] SQL문 실행 방법 3가지

    Date2013.12.19 CategoryDatabase Byhooni Views12123
    Read More
  2. [css] z-index에 설정할 수 있는 최대값?

    Date2013.12.20 CategoryDevelop Byhooni Views14705
    Read More
  3. [js] jQuery plugin 요약

    Date2013.12.20 CategoryDevelop Byhooni Views10700
    Read More
  4. [linux] CentOS 터미널 언어 설정(한글/영어)

    Date2013.12.22 CategorySystem/OS Byhooni Views18513
    Read More
  5. [linux] root 전환시 패스워드 없이 su 사용하기

    Date2013.12.22 CategorySystem/OS Byhooni Views12685
    Read More
  6. [php] GregorianToJD(), JDToGregorian() 함수 내용

    Date2013.12.25 CategoryDevelop Byhooni Views10593
    Read More
  7. [php] 하루 전 날짜 쉽게 구하기.

    Date2013.12.25 CategoryDevelop Byhooni Views12200
    Read More
  8. [용어] POC, Pilot, BMT에 대한 IT 업계에서 통용되는 의미

    Date2014.01.02 CategoryEtc Byhooni Views41951
    Read More
  9. [js] AngularJS를 소개합니다.

    Date2014.01.06 CategoryDevelop Byhooni Views13014
    Read More
  10. iOS 에서 쓸만한 오프라인 구글지도 찾기

    Date2014.01.06 CategoryEtc Byhooni Views16035
    Read More
  11. [ios] UIButton multi-line iOS7

    Date2014.01.09 CategoryDevelop Byhooni Views11435
    Read More
  12. [linux] iconv를 이용하여 euc-kr 문서를 utf-8로 대량으로 변환하기

    Date2014.01.09 CategorySystem/OS Byhooni Views12219
    Read More
Board Pagination Prev 1 ... 65 66 67 68 69 70 71 72 73 74 ... 98 Next
/ 98