我有一个带字体的自定义按钮。
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"。
我不想改变按钮的框架,字体的大小。更改插入的DOESNOT可以避免问题。这是一个模拟器错误或helvetica字体的问题?有什么工作吗?
答案 0 :(得分:0)
将uibutton title设置为nil然后使用文本创建标签并将子视图添加到uibutton全部,现在它将根据您的需要正确显示文本