Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
中央にテキストが入ったUIボタンがあります。プログラムでテキストを更新すると、次のようになります。テキストbutton.titleLabel.text = newValue;が中央に配置されなくなり、代わりに非常に奇妙な位置になります(中央に配置されたり、左揃えに配置されたりしません)...ボタンでテキストを水平方向に中央揃えに更新するにはどうすればよいですか?
button.titleLabel.text = newValue;
UIButton のタイトルは、setTitle:forState: メソッドを使用して設定する必要があります。