{"id":1132,"date":"2019-04-02T14:26:08","date_gmt":"2019-04-02T05:26:08","guid":{"rendered":"http:\/\/idealive.jp\/blog\/?p=1132"},"modified":"2019-04-02T14:28:28","modified_gmt":"2019-04-02T05:28:28","slug":"swift4-2-uiactivityindicatorview%e3%81%a7%e8%aa%ad%e3%81%bf%e8%be%bc%e3%81%bf%e4%b8%ad%e3%82%a2%e3%83%8b%e3%83%a1%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3%e3%82%92%e8%a1%a8%e7%a4%ba%e3%81%97%e3%81%a6","status":"publish","type":"post","link":"https:\/\/idealive.jp\/blog\/2019\/04\/02\/swift4-2-uiactivityindicatorview%e3%81%a7%e8%aa%ad%e3%81%bf%e8%be%bc%e3%81%bf%e4%b8%ad%e3%82%a2%e3%83%8b%e3%83%a1%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3%e3%82%92%e8%a1%a8%e7%a4%ba%e3%81%97%e3%81%a6\/","title":{"rendered":"Swift4.2 &#8211; UIActivityIndicatorView\u3067\u8aad\u307f\u8fbc\u307f\u4e2d\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u3092\u8868\u793a\u3057\u3066\u307f\u3088\u3046"},"content":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f sohnishi \u3067\u3059\u3002<\/p>\n<p>Swift4.2\u3067\u3088\u304f\u3042\u308b\u3000\u8aad\u307f\u8fbc\u307f\u4e2d\u306e\u304f\u308b\u304f\u308b\u3092\u4f5c\u3063\u3066\u307f\u307e\u3059\u3002<\/p>\n<p>\u3069\u306eViewController\u304b\u3089\u3067\u3082\u547c\u3073\u51fa\u305b\u308b\u3088\u3046\u306b\u30e1\u30bd\u30c3\u30c9\u5316\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>&nbsp;<\/p>\n<pre class=\"lang:default decode:true\" title=\"Functions.swift\">\u3000\u3000\u3000\u3000\r\n\r\nimport UIKit\r\n\r\nclass Functions {\r\n\u3000\u3000 \/\/ \u30a4\u30f3\u30c7\u30a3\u30b1\u30fc\u30bf\u30fc\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u958b\u59cb\u30e1\u30bd\u30c3\u30c9\r\n    func startIndicatorAnimation(viewController: UIViewController, activityIndicatorView: UIActivityIndicatorView) {\r\n        \/\/ \u753b\u9762\u30bf\u30c3\u30d7\u7121\u52b9\u5316\r\n        viewController.view.isUserInteractionEnabled = false\r\n        \/\/ \u30a4\u30f3\u30c7\u30a3\u30b1\u30fc\u30bf\u30fc\u8868\u793a\r\n        activityIndicatorView.hidesWhenStopped = true\r\n        activityIndicatorView.center = viewController.view.center\r\n        activityIndicatorView.style = .whiteLarge\r\n        activityIndicatorView.color = .black\r\n        \r\n        viewController.view.addSubview(activityIndicatorView)\r\n        \/\/ \u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u958b\u59cb\r\n        activityIndicatorView.startAnimating()\r\n    }\r\n\r\n\u3000\u3000 \/\/ \u30a4\u30f3\u30c7\u30a3\u30b1\u30fc\u30bf\u30fc\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u505c\u6b62\u30e1\u30bd\u30c3\u30c9\r\n    func stopIndicatorAnimation(viewController: UIViewController, activityIndicatorView: UIActivityIndicatorView) {\r\n        \/\/ \u753b\u9762\u64cd\u4f5c\u6709\u52b9\u5316\r\n        viewController.view.isUserInteractionEnabled = true\r\n        \/\/ \u30a4\u30f3\u30c7\u30a3\u30b1\u30fc\u30bf\u30fc\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u30b9\u30c8\u30c3\u30d7\r\n        activityIndicatorView.stopAnimating()\r\n    }\r\n\r\n}\r\n<\/pre>\n<pre class=\"lang:default decode:true\" title=\"ViewController.swift\">import UIKit\r\n\r\nclass ViewController: UIViewController {\r\n\r\n    let functions = Functions()\r\n\r\n    let activityIndicatorView = UIActivityIndicatorView()\r\n    \r\n    override func viewDidLoad() {\r\n        super.viewDidLoad()\r\n\r\n            print(\"\u30a4\u30f3\u30c7\u30a3\u30b1\u30fc\u30bf\u30fc\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u30b9\u30bf\u30fc\u30c8\")\r\n            self.functions.startIndicatorAnimation(viewController: self, activityIndicatorView: self.activityIndicatorView)\r\n            print(\"\u30a4\u30f3\u30c7\u30a3\u30b1\u30fc\u30bf\u30fc\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u30b9\u30c8\u30c3\u30d7\")\r\n            self.functions.stopIndicatorAnimation(viewController: self, activityIndicatorView: self.activityIndicatorView)\r\n\r\n    }   \r\n    \r\n}\r\n\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>\u4ee5\u4e0a\u3001\u7c21\u5358\u306a\u30a4\u30f3\u30c7\u30a3\u30b1\u30fc\u30bf\u30fc\u306e\u4f7f\u3044\u65b9\u3067\u3057\u305f\uff01<\/p>\n<p>\u304f\u308b\u304f\u308b\u306e\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u306f\u30e9\u30a4\u30d6\u30e9\u30ea\u3082\u305f\u304f\u3055\u3093\u3042\u308b\u306e\u3067\u3001<\/p>\n<p>\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u306b\u3053\u3060\u308f\u308b\u65b9\u306f\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u63a2\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f sohnishi \u3067\u3059\u3002 Swift4.2\u3067\u3088\u304f\u3042\u308b\u3000\u8aad\u307f\u8fbc\u307f\u4e2d\u306e\u304f\u308b\u304f\u308b\u3092\u4f5c\u3063\u3066\u307f\u307e\u3059\u3002 \u3069\u306eViewController\u304b\u3089\u3067\u3082\u547c\u3073\u51fa\u305b\u308b\u3088\u3046\u306b\u30e1\u30bd\u30c3\u30c9\u5316\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002 &nbsp; \u3000\u3000\u3000\u3000 impo&#8230;<a class=\"read-more-link button\" href=\"https:\/\/idealive.jp\/blog\/2019\/04\/02\/swift4-2-uiactivityindicatorview%e3%81%a7%e8%aa%ad%e3%81%bf%e8%be%bc%e3%81%bf%e4%b8%ad%e3%82%a2%e3%83%8b%e3%83%a1%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3%e3%82%92%e8%a1%a8%e7%a4%ba%e3%81%97%e3%81%a6\/\">\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":3,"featured_media":772,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22],"tags":[],"class_list":["post-1132","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-swift"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/idealive.jp\/blog\/wp-json\/wp\/v2\/posts\/1132"}],"collection":[{"href":"https:\/\/idealive.jp\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/idealive.jp\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/idealive.jp\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/idealive.jp\/blog\/wp-json\/wp\/v2\/comments?post=1132"}],"version-history":[{"count":3,"href":"https:\/\/idealive.jp\/blog\/wp-json\/wp\/v2\/posts\/1132\/revisions"}],"predecessor-version":[{"id":1135,"href":"https:\/\/idealive.jp\/blog\/wp-json\/wp\/v2\/posts\/1132\/revisions\/1135"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/idealive.jp\/blog\/wp-json\/wp\/v2\/media\/772"}],"wp:attachment":[{"href":"https:\/\/idealive.jp\/blog\/wp-json\/wp\/v2\/media?parent=1132"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/idealive.jp\/blog\/wp-json\/wp\/v2\/categories?post=1132"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/idealive.jp\/blog\/wp-json\/wp\/v2\/tags?post=1132"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}