Develop
2014.01.09 14:19

[ios] UIButton multi-line iOS7

조회 수 11437 추천 수 0 댓글 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];

?

  1. [c] 숫자(int, Number)를 hex코드로 변환하는 소스

  2. [c] 숫자 맞추는 게임..

  3. [c] 소켓주소 구조체에 대해..

  4. [c] 소켓의 세가지 동작모드

  5. [c] 소켓 프로그래밍 요약..

  6. [c] 소켓 스트림 서버/클라이언트 (UDP)

  7. [c] 소수점 반올림^^

  8. [c] 소수 구하기 #2 (입력한 숫자가 소수인지 판별하기..)

  9. [c] 소수 구하기 #1 (한정된 숫자 내에 있는 소수 걸러내기)

  10. [c] 셀프 넘버(Self Number) 구하기

  11. [c] 서비스 거부 공격(DoS;Denial of Service) 간단 소스.. ㅋㅋ

  12. [c] 분수계산 함수^^

  13. [c] 베지어 곡선(Bézier curve) 알고리즘

  14. [c] 베이지언(Bayesian) 패턴인식 과제 ㅋㅋ

  15. [c] 반올림 함수!! ㅋㅋ

  16. [c] 바로 보고 정리할 것.. ㅋㄷㅋㄷ

Board Pagination Prev 1 ... 51 52 53 54 55 ... 74 Next
/ 74