Answers for "ui lable with icon to the left"

0

ui lable with icon to the left

let labelLeft = SMIconLabel(frame: CGRect(x: 10, y: 10, width: view.frame.size.width - 20, height: 20))
labelLeft.text = "Icon on the left, text on the left"

// Here is the magic
labelLeft.icon = UIImage(named: "Bell")    // Set icon image
labelLeft.iconPadding = 5                  // Set padding between icon and label
labelLeft.numberOfLines = 0                // Required
labelLeft.iconPosition = (.left, .top)   // Icon position
view.addSubview(labelLeft)
Posted by: Guest on May-05-2021

Browse Popular Code Answers by Language