Develop
2014.01.09 14:19
[ios] UIButton multi-line iOS7
조회 수 11433 댓글 0
예전에 멀티라인 버튼을 아래처럼 작성했던게..
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];
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
849 | Develop | [c++] mfc 간단한 파일 입출력 예제 | hooni | 2013.04.23 | 13523 |
848 | System/OS | [linux] 쉘 환경변수 PS1(프롬프트) | hooni | 2003.04.23 | 13492 |
847 | System/OS | [linux] 기존 환경설정 저장하면서 커널 컴파일.. | hooni | 2003.04.23 | 13456 |
846 | System/OS | [linux] 간단한 vi편집기 사용 명령 | hooni | 2003.04.23 | 13456 |
845 | Develop | [c] 기본 자료형(int)이 표현할 수 없는 큰 수(Big number)를 덧셈하는 코드. 1 | hooni | 2013.04.23 | 13448 |
844 | System/OS | [linux] 프로그램 설치방법 (내공쌓기) | hooni | 2003.04.23 | 13433 |
843 | System/OS | [linux] 쉘 스크립트에 대한 설명과 예제.. | hooni | 2003.04.23 | 13413 |
842 | System/OS | [ms-sql] 프로시져 예제.. | hooni | 2013.04.23 | 13406 |
841 | Algorithm | 스터디 자료, 암호화에 대해서.. 나중에 볼 ppt.. | hooni | 2013.04.23 | 13370 |
840 | System/OS | [linux] Xwindow/Xmanager 사용 | hooni | 2003.04.23 | 13332 |
839 | Develop | [ios] 간단한 방법으로 OS버전 확인하기. | hooni | 2013.09.24 | 13306 |
838 | Develop | [c#] 파일(File) 쓰기 ㅎㅎ | hooni | 2013.04.23 | 13289 |