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”的顶部。
我不想改变按钮的框架中,font.Changing插图不列入避免问题的大小。这是模拟器错误还是helvetica字体问题?任何工作?
可能重复时sizeToFit是文本所谓](http://stackoverflow.com/questions/20978640/uibutton-does-not-resize-height-correctly-with-custom-font-when-sizetofit-is-cal) – rishi
你也可以看看这个[链接](http://stackoverflow.com/questions/10200032/cropped-uibutton-title/10200908#10200908) – rishi