1 year ago

#370588

test-img

Fernando Ivan Perez Ruiz

Title in button shrinks Swift

I have a button but when I add it to my view the text shrinks... I have no idea what is going on I think I've tried everything. Please help! Thanks!!

Button

This is how I'm creating my button

 private lazy var nextLessonButton: UIButton = {
    let button = UIButton()
    button.setTitle("Next Lesson", for: .normal)
    button.setImage(UIImage(systemName: "chevron.right"), for: .normal)
    button.translatesAutoresizingMaskIntoConstraints = false
    button.semanticContentAttribute = .forceRightToLeft
    button.backgroundColor = .red
    return button
}()

swift

xcode

uibutton

programmatically-created

0 Answers

Your Answer

Accepted video resources