带有特殊字符的按钮标题

时间:2018-07-27 10:16:40

标签: button title

我是Swift的新手,需要您的帮助。

这是我的自定义课程:

public JsonResult LoadVolunteers()  
{      
  List<Volunteers> listVol = new List<Volunteers>();
  //this is just one object for your understanding purpose, you may call service here to read the data from database
  var result= listVol.Add(new Volunteer
              {
                 name="XYZ", 
                 email="xyz@hotmail.com",
                 phone="0000000454",
                 options=""
              });
  return Json(result, JsonRequestBehavior.AllowGet);  
}  

我在这里使用我的自定义类:

@objc class CustomButton: UIButton {

    override init(frame: CGRect)
    {
        super.init(frame: frame)
    }
    required init?(coder aDecoder: NSCoder)
    {
        fatalError("init(coder:) has not been implemented")
    }

    @objc func loadMyCustomButtonWith(buttonTitle:String,fontSize : CGFloat)
    {
        self.titleLabel?.textColor = UIColor.white
        self.titleLabel?.font = UIFont.systemFont(ofSize: fontSize)
        self.setTitle(buttonTitle,for: .normal)
    }

}

buttonTitleStr从let buttonTitleStr = "RÉGLAGE" Var myButton = UIButton(frame: CGRect(x: 0, y: 0, width: 150, height: 150)) myButton.loadMyCustomButtonWith(buttonTitle: buttonTitleStr,fontSize: myButton.frame.size.height * 0.10) 更改为“RÉGLAGE”(即,从“REGLAGE”更改为“É”,这是怎么回事?

0 个答案:

没有答案