iOS 단추 의 텍스트 에 밑줄 을 그 리 는 방법 을 추가 합 니 다.

문제:아래 그림 의 오른쪽 단추 문자 효 과 를 실현 합 니 다.

방법:

[MyTools createMyImageview:topEditView frame:CGRectMake(widthAll-90, 12, 17, 16) imageName:@"    _    .png"];
UIButton *downMoreButton = [MyTools createMyBtn:@"    " frame:CGRectMake(widthAll-70, 10, 60, 20) uiview:topEditView uifont:14 color:[UIColor colorWithRed:92/255.0 green:218/255.0 blue:231/255.0 alpha:1]];
NSMutableAttributedString *title = [[NSMutableAttributedString alloc] initWithString:@"    "];
NSRange titleRange = {0,[title length]};
[title addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] range:titleRange];
[downMoreButton setAttributedTitle:title
forState:UIControlStateNormal];
[downMoreButton.titleLabel setFont:[UIFont systemFontOfSize:14]];
[downMoreButton addTarget:self action:@selector(downMore) forControlEvents:UIControlEventTouchUpInside];
iOS 버튼 에 있 는 텍스트 에 밑줄 을 그 리 는 방법 을 소개 해 드 리 겠 습 니 다.도움 이 되 셨 으 면 좋 겠 습 니 다!

좋은 웹페이지 즐겨찾기