Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

All on the same level is just fine

The lowest two appear empty

When there is just one that is the lowest, then this one appears empty

When the difference in y coordinate is smaller then the text height, then the text seems to be cut off somehow.

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.
like image 653
Hermann Klecker Avatar asked Feb 19 '23 11:02

Hermann Klecker


2 Answers

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.

enter image description here

enter image description here

enter image description here

like image 111
Bio Avatar answered Apr 29 '23 16:04

Bio


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).

like image 23
Hermann Klecker Avatar answered Apr 29 '23 16:04

Hermann Klecker