2014-07-17 2 views
0

글꼴이있는 사용자 지정 단추가 있습니다.UIButton 제목이 잘림

customButtonSynchronize = [UIButton buttonWithType:UIButtonTypeCustom]; 
customButtonSynchronize.frame=CGRectMake(578, 27.5, 91, 29) ; 
[customButtonSynchronize setBackgroundImage:[UIImage imageNamed:@"synchronize.png"] 
            forState:UIControlStateNormal]; 
customButtonSynchronize.titleLabel.font = [UIFont fontWithName:@"HelveticaLTStd-Roman" size:14.0f]; 
[customButtonSynchronize setTitle:@"Sincronizzare" forState:UIControlStateNormal]; 
/////HERE////////// 
customButtonSynchronize.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter; 
customButtonSynchronize.contentVerticalAlignment = UIControlContentVerticalAlignmentTop; 
customButtonSynchronize.contentEdgeInsets = UIEdgeInsetsMake(8, 0, 0, 0); 
customButtonSynchronize.backgroundColor=[UIColor clearColor]; 
[customButtonSynchronize addTarget:self action:@selector(synchronizeDB:) forControlEvents:UIControlEventTouchUpInside]; 

위의 텍스트는 약간 "잘랐다"는 듯합니다. "S"의 상단을보십시오.

enter image description here

나는 버튼의 프레임하여이 삽입 DOESNOT 문제를 방지 font.Changing의 크기를 변경 싶지 않다. 그것은 시뮬레이터 버그 또는 helvetica 글꼴 문제가 있습니까? 어떤 일을해야합니까? 무기 호에

+0

중복 가능성을 필요에 따라 올바르게 텍스트를 표시합니다 전화] (http://stackoverflow.com/questions/20978640/uibutton-does-not-resize-height-correctly-with-custom-font-when-sizetofit-is-cal) – rishi

+1

당신도 이것을 볼 수 있습니다 [링크] (http://stackoverflow.com/questions/10200032/cropped-uibutton-title/10200908#10200908) – rishi

답변

0

설정있는 UIButton 제목은 다음 텍스트 레이블을 만들고 그게 전부있는 UIButton에 하위 뷰를 추가, 지금은 sizeToFit이 때있는 UIButton 사용자 정의 글꼴로 올바르게 높이의 크기를 조정하지 않습니다 [의