Skip to content

Button 0

Mohammad Azmal Hossain edited this page Apr 6, 2017 · 2 revisions

let button = UIButton()

    button.frame = CGRect(x: 5, y: 70, width: self.view.frame.size.width - 10, height: 150)
    button.setTitle("Attractive Places", for: .normal)
     //button.setTitle("✸", for: .normal)
   // button.setTitleColor(.white, for: .normal)
   // button.tintColor = .brown
    
    //button.backgroundColor = UIColor.blue
     button.setBackgroundImage(#imageLiteral(resourceName: "imageName"), for: .normal)
    button.layer.borderWidth = 1;
     let myColor = UIColor(red: 0.5, green:0.5, blue: 0, alpha: 1.0)
     button.layer.borderColor = myColor.cgColor
    // button.layer.borderColor = UIColor(red: 0.5, green:0.5, blue: 0, alpha: 1.0).cgColor
    button.layer.cornerRadius = CGFloat(10)
    button.layer.masksToBounds = true

//button.titleEdgeInsets = UIEdgeInsetsMake(x10,-10,-10,-10) button.titleEdgeInsets = UIEdgeInsets(top: -120, left: -200, bottom: 0, right: 0) // button.contentEdgeInsets = UIEdgeInsetsMake(5,5,5,5)

    //button.titleLabel?.font = UIFont(name: "Helvetica-Bold", size: 13)
    // button.titleLabel?.frame = CGRect(x: 0, y: 10, width: 100, height: 80)
    //button.titleLabel?.backgroundColor = .yellow
    button.titleLabel?.textColor = .red
    button.titleLabel?.textAlignment = .left
    // button.titleLabel?.lineBreakMode = .byWordWrapping

   // button.translatesAutoresizingMaskIntoConstraints = false
    button.addTarget(self, action: #selector(targetAttractive), for: .touchUpInside)
    return button
}()
Clone this wiki locally