简体   繁体   中英

UIButton Title does not appear or is cut - bottom most label only

I have a view with a number of buttons. The issue persists regardless whether I have 3, 4 or 5 Buttons. The one most bottom (with the highest y coordinate) does not show its tile. By playing around with the coordinates I found out that the title is sort of cut. See the screenshots for details.

All that I changed between those examples are the y coordinates of the buttons. It always happens to the button most down in the screen.

所有在同一水平上都很好

最低的两个看起来是空的

如果只有一个最低,那么这个看起来是空的

当y坐标的差异小于文本高度时,文本似乎以某种方式被切断。

Additional information: I am using storyboard. The View hierarchy:

- UIView (The default empty UIView that is linked to the view controller's self.view)
--- UIScrollView
------ UIImage (The background image. Deleting it does not change anything)
------ UIButton
------ UIButton
------ UIButton
-------Lots of constraints, automatically generated.

Try changing the title from Plain to Attributed for all the UIButtons that are suffering from this problem. Then you can change them back to Plain and it should solve this (odd) issue.

在此输入图像描述

在此输入图像描述

在此输入图像描述

I did not nail it down to its reason. The way I solved it was deleting those 3 buttons and creating them again in IB (Storyboard).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM