技術と本について書くブログ

技術と本について書くblog。技術メモなど雑記を書いているblog。

2019-09-01から1ヶ月間の記事一覧

CoreMotionを使っての回転判定

import CoreMotion let manager = CMMotionManager() override func viewDidLoad() { //取得の間隔 manager.accelerometerUpdateInterval = 0.01 manager.startAccelerometerUpdates(to: OperationQueue.current!, withHandler: { (data, error) in self.get…

UITabBarの上の線を無くす方法

iOS

layerを透明にする cliptsToBoundsも必要 class CustomTabBarController: UITabBarController { override func viewDidLoad() { super.viewDidLoad() tabBar.layer.borderWidth = 0.5 tabBar.layer.borderColor = UIColor.clear.cgColor tabBar.clipsToBound…

テラスハウス: Boys & Girls in the City 2015年東京編をやっと見た話

テラスハウスのnetflixの最初の東京編が始まって今更見たのですが、個人的に結構男性陣の推しが多い。 アーマン:仕事は全然してなさそうだけど、ハワイアンな時間が流れててすごくいい。ムードメーカー 半さん:ハイスペック人材。彼女持ち。タバコ吸わなけ…

テラスハウス: Boys & Girls in the City 2015年東京編をやっと見た話

テラスハウスのnetflixの最初の東京編が始まって今更見たのですが、個人的に結構男性陣の推しが多い。 アーマン:仕事は全然してなさそうだけど、ハワイアンな時間が流れててすごくいい。ムードメーカー 半さん:ハイスペック人材。彼女持ち。タバコ吸わなけ…

Kotlinの可変長引数について

Kotlinには可変長引数が可能。ちなみにJava5からもある。 修飾子 varargをつける 例 fun hoge(vararg fuga: Int) { var sum = 0 for(i in fuga) { sum += i } return sum } hoge(1,10,100) 配列ごと渡す場合には変数名の前に *をつける val hoges = arrayOf(…

複数のXCodeを入れている時に切り替えるコマンドxcode-select+cocoapodsも

iOS

切り替え $ sudo xcode-select --switch /Applications/Xcode.app 確認 $ xcode-select --print-path cocoapods バージョン確認 pod --version バージョン削除 sudo gem uninstall cocoapods --version=1.5.3 インストール sudo gem install cocoapods --ver…

アノーテーション@VisibleForTestingをつける

Androidのコードを読んでいると@VisibleForTestingというアノテーションがある。 これはテストのためにつけたという意味 @VisibleForTesting public hoge() { }

ViewをConstraintLayoutを継承して呼ぶ時

class View1 : ConstraintLayout { constructor(context: Context) : super(context) constructor(context: Context, attrs: AttributeSet) : super(context, attrs) constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(contex…

java.lang.RuntimeException: Method optJSONObject in org.json.JSONObject not mocked. See http://g.co/androidstudio/not-mocked for details.が出た時の解決方法

java.lang.RuntimeException: Method optJSONObject in org.json.JSONObject not mocked. See http://g.co/androidstudio/not-mocked for details. 解決方法 http://g.co/androidstudio/not-mockedに書かれているように gradleファイルに以下を追加 testOpti…

ERROR: The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.10 and higher.の対象法

ERROR: The Android Gradle plugin supports only Kotlin Gradle plugin version <バージョン番号> and higher. が出た時の対象法 gradleファイルのext.kotlin_versionを指定バージョン以降にあげる ext.kotlin_version = '1.3.10'

Cause: buildOutput.apkInfo must not be nullの対象法

Cause: buildOutput.apkInfo must not be null 対処法 Build -> Clean Project してクリーンをしてから行う