2016-09-28 7 views
-6

ここでは、ボタンのタイトルにアラビア語の後者を書いています。そして、タイトルのラベルを中央に配置します。しかし、問題は、いくつかのアラビア語の後者がボタンのバトム境界とボタン。どのように私は私のコードはボタンのタイトルの位置を設定する方法

それを解決することは

optionA.setTitle(Option[0], forState: .Normal) 
optionB.setTitle(Option[1], forState: .Normal) 
optionC.setTitle(Option[2], forState: .Normal) 
optionD.setTitle(Option[3], forState: .Normal) 

ノウサギoptionA、optionB、optionC、optionDはボタンであり、オプションはアラビア後者

enter image description here

答えて

3

この

を使用しての配列です
let button = UIButton(type: .roundedRect) 
button.frame = CGRect(x: 20, y: 20, width: 200, height: 72) 
button.setTitle("مرحبا", for: .normal) 
button.titleEdgeInsets = UIEdgeInsetsMake(0, 10, 0, 0) 
button.contentHorizontalAlignment = .center 
self.view.addSubview(button) 

そして、button.titleEdgeInsetsをpに変更してください言及。

関連する問題