Try this:
button.titleLabel?.numberOfLines = 1
button.titleLabel?.adjustsFontSizeToFitWidth = true
button.titleLabel?.lineBreakMode = .byClipping //<-- MAGIC LINE
I’m not sure why this does the trick but it does 🙂
More Related Contents:
- Objective C – How to store NSMutableArray inside of NSMutableDictionary
- how to download and open a doument in myapp in ios [closed]
- Label doesn’t show text
- Opening the Settings app from another app
- Creating a UICollectionView programmatically
- iOS Universal Links are not opening in-app
- iOS 7 TableView like in Settings App on iPad
- Understanding NSRunLoop
- UIView and initWithFrame and a NIB file. How can I get the NIB file loaded?
- How to add a border just on the top side of a UIView
- iOS: Issue with ampersand in the URL string
- Disable UIPageViewController bounce
- With Auto Layout, how do I make a UIImageView’s size dynamic depending on the image?
- How to add subview inside UIAlertView for iOS 7?
- Does Apple provide an API for SIRI?
- How to do Slow Motion video in IOS
- How to change the tint color of the clear button on a UITextField
- malloc: *** error: incorrect checksum for freed object – object was probably modified after being freed
- How can I programmatically determine if my app is running in the iphone simulator?
- Rotation methods deprecated, equivalent of ‘didRotateFromInterfaceOrientation’?
- Facebook Login – iOS 9 – Without Safari
- CGFloat-based math functions?
- iphone image captured from camera rotate -90 degree automatically
- Why can’t I call the default super.init() on UIViewController in Swift?
- iOS 11 large-title navigation bar not collapsing
- Design UITableView’s section header in Interface Builder
- Xcode 6: can’t connect any IBOutlet to ViewController
- Dynamically getting height of UILabel according to Text return different Value for iOS 7.0 and iOS 6.1
- UIDevice currentDevice model possible values
- Upload image to the PHP server from iOS