Develop
2014.01.09 14:19
[ios] UIButton multi-line iOS7
조회 수 11437 댓글 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] 민수형 소스(도메인소켓포함) | hooni | 2013.04.23 | 6522 |
848 | Develop | [c] 바로 보고 정리할 것.. ㅋㄷㅋㄷ | hooni | 2013.04.23 | 7139 |
847 | Develop | [c] 반올림 함수!! ㅋㅋ | hooni | 2003.04.23 | 8084 |
846 | Develop | [c] 베이지언(Bayesian) 패턴인식 과제 ㅋㅋ | hooni | 2013.04.23 | 7095 |
845 | Develop | [c] 베지어 곡선(Bézier curve) 알고리즘 | hooni | 2013.04.23 | 8557 |
844 | Develop | [c] 분수계산 함수^^ | hooni | 2003.04.23 | 10055 |
843 | Develop | [c] 서비스 거부 공격(DoS;Denial of Service) 간단 소스.. ㅋㅋ | hooni | 2013.04.23 | 6718 |
842 | Develop | [c] 셀프 넘버(Self Number) 구하기 1 | hooni | 2016.09.09 | 2266 |
841 | Develop | [c] 소수 구하기 #1 (한정된 숫자 내에 있는 소수 걸러내기) | hooni | 2003.04.23 | 7811 |
840 | Develop | [c] 소수 구하기 #2 (입력한 숫자가 소수인지 판별하기..) | hooni | 2013.04.23 | 10990 |
839 | Develop | [c] 소수점 반올림^^ | hooni | 2003.04.23 | 8478 |
838 | Develop | [c] 소켓 스트림 서버/클라이언트 (UDP) | hooni | 2013.04.23 | 7600 |