![](/img/trans.png)
[英]A long UIButton title label truncates in the center instead of on the right
[英]Title on a UIButton truncates
我已經將UIButton設置為導航欄的titleView。 但是,無論按鈕有多寬,標題似乎都被截斷了。 為什么?
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button setTitle:[[NSDate date] stringWithNSDateFormatterMediumStyle] forState:UIControlStateNormal];
[button setFrame:CGRectMake(0, 0, 150, 40)];
self.navigationItem.titleView = button;
[button setFrame:CGRectMake(0, 0, 250, 40)]; // are you sure your button is wide enough?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.