简体   繁体   中英

Set UIButton width 0 when no title with AutoLayout

I need set UIButton title dynamically and its width fit it's content , But when I set title with @"" or nil string , it's width still not be zero , it seems about 30 pt.

I had tried to set its Intrinsic Size Placeholder to 0 at Storyboard and sizeToFit method , But both didn't work.

You can get your answer from below link and Apply any of the solution.

iOS: UIButton resize according to text length

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