UIButton标题剪辑

时间:2014-07-17 03:07:44

标签: ios ipad ios7 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可以避免问题。这是一个模拟器错误或helvetica字体的问题?有什么工作吗?

1 个答案:

答案 0 :(得分:0)

将uibutton title设置为nil然后使用文本创建标签并将子视图添加到uibutton全部,现在它将根据您的需要正确显示文本