{"id":646,"date":"2021-09-17T15:21:20","date_gmt":"1970-01-01T00:00:00","guid":{"rendered":"http:\/\/swift.tecc0.com\/?p=646"},"modified":"2021-09-17T15:21:20","modified_gmt":"1970-01-01T00:00:00","slug":"post-646","status":"publish","type":"post","link":"https:\/\/swift.tecc0.com\/?p=646","title":{"rendered":"Swift\u3067UILabel\u306etextAlignment\u3092programmatically\u306b\u5909\u66f4\u3059\u308b\u65b9\u6cd5"},"content":{"rendered":"<p><strong>Swift\u3067UILabel\u306etextAlignment\u3092\u8a2d\u5b9a<\/strong>\u3059\u308b\u65b9\u6cd5\u3060\u3088\u3002<\/p>\n<p>\u4e2d\u592e\u63c3\u3048\u3001\u5de6\u63c3\u3048\u3001\u53f3\u63c3\u3048\u304c\u3067\u304d\u308b\u3088\u3002<\/p>\n<p>StoryBoard\u3092\u4f7f\u3063\u3066\u3082\u3082\u3061\u308d\u3093\u3067\u304d\u308b\u3051\u3069\u3001\u4eca\u56de\u306f<strong>Programmatically<\/strong>\u306b\u5909\u66f4\u3059\u308b\u65b9\u6cd5\u3060\u3088\u3002<\/p>\n<p>&nbsp;<\/p>\n<h3>Swift\u3067UILabel\u306etextAlignment\u3092programmatically\u306b\u5909\u66f4\u3059\u308b<\/h3>\n<pre class=\"lang:swift decode:true\">import UIKit\r\n\r\nclass ViewController: UIViewController {\r\n\r\n    @IBOutlet weak var label: UILabel!\r\n    \r\n    override func viewDidLoad() {\r\n        super.viewDidLoad()\r\n        label.textAlignment = .left \/\/ \u5de6\u63c3\u3048\r\n        label.textAlignment = .right \/\/ \u53f3\u63c3\u3048\r\n        label.textAlignment = .center \/\/ \u4e2d\u592e\u63c3\u3048\r\n    }\r\n}<\/pre>\n<p>\u3053\u3093\u306a\u611f\u3058\u3067\u3001<strong>textAlignment<\/strong>\u3092\u30d7\u30ed\u30b0\u30e9\u30e0\u4e0a\u304b\u3089\u5909\u66f4\u3067\u304d\u308b\u3088\u3002<\/p>\n<p>\u6ce8\u610f\u3057\u305f\u3044\u306e\u306f\u3001label\u306e\u7bc4\u56f2\u3067\u306e\u8a71\u3060\u304b\u3089\u3001width\u304c\u8db3\u308a\u306a\u3044\u3068\u671f\u5f85\u901a\u308a\u306e\u7d50\u679c\u306b\u306a\u3089\u306a\u3044\u3088\u3002<\/p>\n<p>\u6c17\u3092\u3064\u3051\u3088\u3046\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Swift\u3067UILabel\u306etextAlignment\u3092\u8a2d\u5b9a\u3059\u308b\u65b9\u6cd5\u3060\u3088\u3002 \u4e2d\u592e\u63c3\u3048\u3001\u5de6\u63c3\u3048\u3001\u53f3\u63c3\u3048\u304c\u3067\u304d\u308b\u3088\u3002 StoryBoard\u3092\u4f7f\u3063\u3066\u3082\u3082\u3061\u308d\u3093\u3067\u304d\u308b\u3051\u3069\u3001\u4eca\u56de\u306fProgrammatically\u306b\u5909\u66f4\u3059\u308b\u65b9\u6cd5\u3060\u3088&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[21],"tags":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/swift.tecc0.com\/index.php?rest_route=\/wp\/v2\/posts\/646"}],"collection":[{"href":"https:\/\/swift.tecc0.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/swift.tecc0.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/swift.tecc0.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/swift.tecc0.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=646"}],"version-history":[{"count":1,"href":"https:\/\/swift.tecc0.com\/index.php?rest_route=\/wp\/v2\/posts\/646\/revisions"}],"predecessor-version":[{"id":647,"href":"https:\/\/swift.tecc0.com\/index.php?rest_route=\/wp\/v2\/posts\/646\/revisions\/647"}],"wp:attachment":[{"href":"https:\/\/swift.tecc0.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=646"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/swift.tecc0.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=646"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/swift.tecc0.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=646"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}