LoginSignup
7
14

【Swift】UIKitのプロパティとメソッドまとめ

Last updated at Posted at 2021-04-04

はじめに

UIKitのプロパティとメソッドをまとめていきます!

UIView

プロパティ

プロパティ名 説明
frame CGRect 位置とサイズの指定
center CGPoint 中心位置を指定
bounds CGRect サイズの指定
backgroundColor UIColor 背景色を設定
isHidden Bool 表示非表示を指定
tag Int タグ付けをする
alpha CGFloat 透過の設定
superView UIView 自分の親のUIViewクラスを取得する
subViews Array 自分の子のUIViewクラスを取得する
transform CGAffineTransform 変形処理
userInterractionEnabled Bool タッチイベントの検知

メソッド

メソッド名 説明
addSubView(view: UIView) サブビューを追加する
removeFromSuperView 親ビューから消去する
addGestureRecognizer() ビューにGestureRecognizerを追加する

UIViewController

プロパティ

プロパティ名 説明
parent UIViewController? 親ViewController
presentingViewController UIViewController? 一つ前のViewController
navigationController UINavigationViewController? ナビゲーションコントローラー
navigationItem UINavigationItem ナビゲーションの項目
View UIView UIViewControllerが管理するUIView
prefersStatusbarHidden Bool ステータスバーを表示非表示

メソッド

メソッド名 説明
loadView() コントローラーが管理するViewを作成する
viewDidLoad() 初回ロードされた時のみ呼び出される
viewWillAppear(Bool) 画面が表示される前に呼び出される
viewDidAppear(Bool) 画面が表示された後に呼び出される
viewWillDisappear(Bool) 画面が閉じる前に呼び出される
viewDidDisappear(Bool) 画面が閉じた後に呼び出される
addChild(UIViewController) 指定したViewControllerを追加
removeFromParent() 親ビューControllerから消去する
present(UIViewController, animated: Bool, completion: (()-Void)?) モーダル画面遷移
dismiss(animated: Bool, completion: (()->Void)?) モーダルで指定のViewControllerの画面を閉じる

UILabel

プロパティ

プロパティ名 説明
text String ラベルが表示するテキスト
font CGRect サイズの指定
backgroundColor UIColor 背景色の設定
textColor UIColor テキストの色の設定
numberOfLines Int 表示の行の設定
adjustsFontSizeToFitWidth Bool 表示の文字が範囲内に表示させるかさせないか
shadowOffset CGSize テキストの影の位置の調整
shadowColor UIColor テキストの影の色の設定
layer CALayer オブジェクトの形の変形
isHidden Bool 表示非表示を設定
tag Ing タグ付けをする
alpha CGFloat 透過の設定
superView UIView 自分の親のUIViewクラスを取得する

UIImageView

プロパティ

プロパティ名 説明
image UIImage 画像の設定
animationImages Array アニメーションのコマを設定
animationDuration TimerInterval アニメーションのコマを切り替える間隔
animationRepeatCount Int アニメーションのリピート回数
isAnimating Bool アニメーションしているかどうか
frame CGRect 位置とサイズの指定
center CGPoint 中心位置を指定
bounds CGRect サイズの指定
backgroundColor UIColor 背景色の設定
isHidden Bool 表示非表示を設定
tag Ing タグ付けをする
alpha CGFloat 透過の設定
transform CGAffineTransform 変形処理

メソッド

メソッド名 説明
startAnimating() イメージのアニメーションを開始させる
stopAnimating() アニメーションを停止させる

UIButton

プロパティ

プロパティ名 説明
titleLabel String? テキストを表示
state UIControl.state ボタンの状態
imageView UIImage 画像の設定
ButtonType UIButton.ButtonType ボタンのタイプを取得
currentTitle String 画像のボタンのタイトルを取得
currentTitleColor UIColor 現在のボタンのタイトルの色を取得
frame CGRect 位置とサイズの指定
center CGPoint 中心位置を指定
bounds CGRect サイズの指定
backgroundColor UIColor 背景色の設定
isHidden Bool 表示非表示を設定
tag Ing タグ付けをする
alpha CGFloat 透過の設定

メソッド

メソッド名 説明
setTitle(title: String, for UIControl.state) ボタンのテキストを設定する
setTitleColor(color: UIColor?, for UIControl.State) ボタンのテキストの色
setImage(image: UIImage?, for: UIControl.state) ボタンに画像を設定する
addTarget(target: Any?, action: Selector, for: UIControl.Event) ターゲットを追加する

UITextField

プロパティ

プロパティ名 説明
delegate UITextFieldDelegate デリゲートを指定する
text String テキストを設定
font UIFont ボタンの状態
textColor UIColor テキストの色の設定
borderStyle UITextBorderStyle 枠線のスタイルを設定(.none, .roundedRect, .line, .bezel)
placeholder String プレースホルダーを設定する
keyboardType UIKeyboardType 入力時のキーボードを指定(.default, .asciiCapable, .numbersAndPunctuation, .URL, .emailAddress, .numberPad, .phonePad, .twitter, .decimalPad)
returnKeyType UIReturnKeyType 入力時のキーボードのreturnキーの表示を指定(.default, .go, .google, .join, .next, .route, .search, .send, .yahoo, .done)
clearButtonMode UITextFieldViewMode クリアボタンの表示を指定する
frame CGRect 位置とサイズの指定
center CGPoint 中心位置を指定
bounds CGRect サイズの指定
backgroundColor UIColor 背景色の設定
isHidden Bool 表示非表示を設定
tag Ing タグ付けをする
alpha CGFloat 透過の設定

メソッド

メソッド名 説明
endEditing(Bool) 編集を終える

デリゲートメソッド

メソッド名 説明
textFieldShouldBeginEditing(_textField: UITextField)->Bool テキストフィールドを編集する直前に呼び出される
textFieldShouldEndEditing(_textField: UITextField)->Bool テキストフィールドを編集が終了する直前に呼び出される
textFieldDidBeginEditing(_textField: UITextField) テキストフィールドを編集する直後に呼び出される
textFieldDidEndEditing(_textField: UITextField) テキストフィールドの編集が終了する直前に呼び出される
textFieldShouldReturn(_textField: UITextField)->Bool Returnがタップされた時に呼ばれる
textFieldShouldClear(_textField: UITextField)->Bool Clearキーが押された時に呼ばれる

UITextView

プロパティ

プロパティ名 説明
delegate UITextViewDelegate デリゲートを指定する
text String テキストを設定
font UIFont ボタンの状態
textColor UIColor テキストの色の設定
keyboardType UIKeyboardType 入力時のキーボードを指定(.default, .asciiCapable, .numbersAndPunctuation, .URL, .emailAddress, .numberPad, .phonePad, .twitter, .decimalPad)
returnKeyType UIReturnKeyType 入力時のキーボードのreturnキーの表示を指定(.default, .go, .google, .join, .next, .route, .search, .send, .yahoo, .done)
frame CGRect 位置とサイズの指定
center CGPoint 中心位置を指定
bounds CGRect サイズの指定
backgroundColor UIColor 背景色の設定
isHidden Bool 表示非表示を設定
tag Ing タグ付けをする
alpha CGFloat 透過の設定

メソッド

メソッド名 説明
endEditing(Bool) 編集を終える
resignFirstResponder() キーボードを閉じる
becomeFirstResponder() キーボードを出す

デリゲートメソッド

メソッド名 説明
textViewShouldBeginEditing(_textView: UITextView)->Bool テキストビューを編集する直前に呼び出される
textViewShouldEndEditing(_textView: UITextView)->Bool テキストビューの編集が終了する直前に呼び出される
textViewDidBeginEditing(_textView: UITextView) テキストビューを編集する直後に呼び出される
textViewDidEndEditing(_textView: UITextView) テキストビューの編集が終了する直後に呼び出される
textViewDidChange(_textView: UITextView) テキストビューの編集後に呼ばれる

UISwitch

プロパティ

プロパティ名 説明
isOn Bool スイッチの状態変化
onTintColor UIColor スイッチがオンと時の外観の色の設定
thumbTintColor UIColor タップする部分の色の設定
frame CGRect 位置とサイズの指定
center CGPoint 中心位置を指定
bounds CGRect サイズの指定
backgroundColor UIColor 背景色の設定
isHidden Bool 表示非表示を設定
tag Ing タグ付けをする
alpha CGFloat 透過の設定

メソッド

メソッド名 説明
setOn(on: Bool, animated: Bool) スイッチの状態変更とアニメーションを発生させる 

UITableView

プロパティ

プロパティ名 説明
delegate UITableViewDelegate デリゲートを指定
dataSource UITableViewDataSource データソースを指定
rowHeight CGFloat セルの高さを設定
separatorStyle UITableViewCellSeparatorStyle セパレーターのスタイル(.none, .singleLine)
separatorColor UIColor セパレーターの色
allowSelection Bool セルの選択の可否 
tableHeaderView UIVIew ヘッダーに表示するUIViewの設定
tableFooterView UIVIew フッターに表示するUIViewの設定
isEditing Bool 編集可能かどうかの識別
estimatedRowHeight CGFloat セルの推定の高さ
visibleCells [UITableViewCell] 完全に表示されるセルのみ表示
bounces Bool 一番端までスクロールした時にバウンドするかどうか
frame CGRect 位置とサイズの指定
center CGPoint 中心位置を指定
bounds CGRect サイズの指定
backgroundColor UIColor 背景色の設定
isHidden Bool 表示非表示を設定
tag Ing タグ付けをする
alpha CGFloat 透過の設定

メソッド

メソッド名 説明
resister(nib: UINib?, forCellWithReuseIdentifier: String) テーブルビューにセルの登録
reloadData() テーブルビューを再度読み込みするn
cellForRow(at: IndexPath) 該当するセルを取得

データソースメソッド

メソッド名 説明
tableView(_tableView: UITableView, numberOfRowsInSection section: Int)->Int ロード時に呼ばれる。セクションに含まれるセルの数を返す
tableView(_tableView: UITableView, cellForRowAt indexPath: IndexPath)->UITableViewCell ロード時に呼ばれるセルの内容を返すようにする
numberOfSections(in tableView: UITableView)->Int ロード時に呼ばれる。セクションの数を返す
tableView(_tableView: UITableView, titleForHeaderInSection section: Int)->String ロード時に呼ばれる。セクションのヘッダーのタイトルに文字列を返す
tableView(_tableView: UITableView, titleForFooterInSection section: Int)->String ロード時に呼ばれる。セクションのフッターのタイトルに文字列を返す
tableView(_tableView: UITableView, canMoveRowAtIndexPath: IndexPath)->Bool セルの移動を許可する
tableView(_tableView: UITableView, moveRowAt sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath) セルが移動された時に呼ばれる

デリゲートメソッド

メソッド名 説明
tableView(_tableView: UITableView, didSelectRowAt indexPath: IndexPath セルタップ時に呼ばれる
tableView(_tableView: UITableView, didDeselectRowAt indexPath: IndexPath) セルの選択を解除する
tableView(_tableView: UITableView, heightForRowAt indexPath: IndexPath)->CGFloat セルの高さを設定

UICollectionView

プロパティ

プロパティ名 説明
delegate UICollectionDelegate デリゲートを指定
dataSource UICollectionDataSource データソースを指定
collectionViewLayout UICollectionViewLayout セルのレイアウトを調整する
frame CGRect 位置とサイズの指定
center CGPoint 中心位置を指定
bounds CGRect サイズの指定
backgroundColor UIColor 背景色の設定
isHidden Bool 表示非表示を設定
tag Ing タグ付けをする
alpha CGFloat 透過の設定

メソッド

メソッド名 説明
resister(nib: UINib?, forCellWithReuseIdentifier: String) コレクションビューにセルの登録
reloadData() コレクションビューを再度読み込みするn
reloadSections(IndexSet) 指定したセクションの再読み込み
reloadItems(at: [indexPath]) 指定したアイテムの再読み込みn
cellForItem(at: IndexPath) 該当するセルを取得

データソースメソッド

メソッド名 説明
collectionView(_collectionView: UICollectionView, numberOfItemsInSection section: Int)->Int ロード時に呼ばれる。セクションに含まれるセルの数を返す
collectionView(_collectionView: UICollectionView, cellForItemAt indexPath: IndexPath)->UICollectionViewCell ロード時に呼ばれるセルの内容を返すようにする
numberOfSections(in collectionView: UICollectionView)->Int ロード時に呼ばれる。セクションの数を返す
collectionView(_collectionView: UICollectionView, canMoveItemAtIndexPath: IndexPath)->Bool アイテムの移動を許可する
collectionView(_collectionView: UICollectionView, moveItemAt sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath) セルが移動された時に呼ばれる

デリゲートメソッド

メソッド名 説明
collectionView(_collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath セルタップ時に呼ばれる
collectionView(_collectionView: UICollectionView, didDeselectItemAt indexPath: IndexPath) セルの選択を解除する

フロウレイアウトメソッド

メソッド名 説明
collectionView(_collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItem indexPath, IndexPath)->CGSize セルのサイズの指定
collectionView(_collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int)->UIEdgeInset コレクションビューの外周余白
collectionView(_collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, miniuminteritemSpacingForSectionAt section: Int)->CGFloat 列の最小余白
collectionView(_collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int)->CGFloat 行の最小余白

UITableViewCell

プロパティ

プロパティ名 説明
textLabel.text String テキストを設定
detailTextLabel.text String 詳細テキストの設定
imageView.image UIImage 画像の設定
selectionStyle UITableViewCellSelectionStyle セルの選択時の色の設定
accessoryType UITableViewCellAccessoryType アクセサリの設定(.checkmark, .detailButton, .disclosureIndicator, .detailDisclosureButton, .detailButton+disclosureIndicator, .none)
isSelected Bool 選択されたいるかどうかを示す
frame CGRect 位置とサイズの指定
center CGPoint 中心位置を指定
bounds CGRect サイズの指定
backgroundColor UIColor 背景色の設定
isHidden Bool 表示非表示を設定
tag Ing タグ付けをする
alpha CGFloat 透過の設定

メソッド

メソッド名 説明
prepareForReuse() 再利用可能なセルを準備する

UICollectionViewCell

プロパティ

プロパティ名 説明
isSelected Bool セルの選択状態
isHighLighted Bool セルのハイライト状態
frame CGRect 位置とサイズの指定
center CGPoint 中心位置を指定
bounds CGRect サイズの指定
backgroundColor UIColor 背景色の設定
isHidden Bool 表示非表示を設定
tag Ing タグ付けをする
alpha CGFloat 透過の設定

メソッド

メソッド名 説明
prepareForReuse() 再利用可能なセルを準備する

UIImage

プロパティ

プロパティ名 説明
size CGSize 画像のサイズを取得
scale CGFloat 画像の倍率
images [UIImage] アニメーションするイメージの配列

メソッド

メソッド名 説明
pngData() イメージをPNGデータに変換
jpegData(compressionQuality) イメージをjpegDataに変換
draw(in: CGRect) 画像を描画する

UIColor

プロパティ

プロパティ名 説明
cgColor CGColor クオーツカラー
ciColor CIColor コアイメージのカラー

メソッド

メソッド名 説明
UIColor(white: CGFloat, alpha: CGFloat) グレースケールを指定してUIColorを作成
UIColor(hue: CGFloat, saturation: CGFloat, brightness: CGFloat, alpha: CGFloat) HSBカラーを使用してUIColorを作成
UIColor(red: CGFloat, green: CGFloat, blue: CGFloat, alpha: CGFloat) 赤緑青透明度を使用してUIColorを作成
UIColor(CGColor: CGColor) CGColorからUIColorを作成
UIColor(CIColor: CIColor) CIColorからUIColorを作成

UISegmentedControl

プロパティ

プロパティ名 説明
selectedSegmentIndex Int 選択中のボタンを設定する
numberOfSegments Int セグメントの個数
selectedSegmentTintColor UIColor セグメントの背景色
isSelected Bool 選択されたいるかどうかを示す
frame CGRect 位置とサイズの指定
center CGPoint 中心位置を指定
bounds CGRect サイズの指定
backgroundColor UIColor 背景色の設定
isHidden Bool 表示非表示を設定
tag Ing タグ付けをする
alpha CGFloat 透過の設定

メソッド

メソッド名 説明
setImage(image: UIImage?, forSegmentAt: Int) 指定したセグメントに画像を入れる
setTitle(title: String?, forSegmentAt: Int) 指定したセグメントにテキストを入れる
insertSegment(withTitle: String, at: Int, animated: Bool) 指定した箇所にセグメントの数を増やす
removeSegment(at: Int, animated: Bool) 指定したセグメントを消去する
insertSegment(with: UIImage, at: Int, animated: Bool) 指定したセグメント画像を追加
insertSegment(withTitle: String, at: 1, animated: Bool) 指定したセグメントにテキストを追加する

UIScrollView

プロパティ

プロパティ名 説明
delegate UIScrollViewDelegate デリゲートを指定する
bounces Bool スクロールをバウンスさせるか
contentSize UISize スクロール画面サイズを指定
indicatorStyle UIScrollViewIndicatorStyle スクロールバーのスタイルを設定する
isPagingEnabled Bool ページごとにスクロールするかどうか
contentOffset CGPoint スクロールビューの原点から移動したポイント
minimumZoomScale CGFloat 縮小した時の最小倍率の設定
maximumZoomScale CGFloat 拡大した時の最小倍率の設定
frame CGRect 位置とサイズの指定
center CGPoint 中心位置を指定
bounds CGRect サイズの指定
backgroundColor UIColor 背景色の設定
isHidden Bool 表示非表示を設定
tag Ing タグ付けをする
alpha CGFloat 透過の設定

デリゲートメソッド

メソッド名 説明
scrollViewWillBeginDragging(_scrollView: UIScrollView) スクロール開始しようとする時に呼ばれる
scrollViewDidScroll(_scrollView: UIScrollView) スクロール中呼ばれる
scrollViewWillEndDragging(_scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer) タップ終了開始時に呼ばれる
scrollViewWillBeginDecelerating(_scrollView: UIScrollView, willDecelerate decelerate: Bool) タップ終了時に呼ばれる
scrollViewWillBeginDecelerating(_scrollView: UIScrollView) 慣性によるスクロール開始時に呼ばれる
scrollViewDidEndDecelerating(_scrollView: UIScrollView) 慣性によるスクロール停止時に呼ばれる
scrollViewWillBeginZooming(_scrollView: UIScrollView, with view: UIView) ズーム開始時に呼ばれる
scrollViewDidZooming(_scrollView: UIScrollView) ズーム中に呼ばれる
scrollViewDidEndZooming(_scrollView: UIScrollView, with view: UIView?, atScale scale: CGFloat) ズーム終了時に呼ばれる
viewForZooming(in scrollView: UIScrollView) ズームしたいUIViewを指定

UINavigationController

プロパティ

プロパティ名 説明
delegate UINavigationController デリゲートを指定する
visibleViewControllers UIViewController
viewControllers [UIViewController] ナビゲーション配下にあるコントローラーの一覧
topViewController UIViewController 最前面のビューコントローラー
isNavigationBarHidden Bool ナビゲーションバーの表示と非表示
navigationBar UINavigationBar ナビゲーションバー

メソッド

メソッド名 説明
pushViewController(UIViewController, animated: Bool) 現在のコントローラーkら指定のビューコントロラーへ進む
popViewController(animated: Bool) 現在のコントローラーから一個前に戻る
popToRootViewController(animated: Bool) ルートビューコントrコーラーに戻る
setViewController(_viewControllers: [UIViewController], animated: Bool) スタックに配置するビューコントローラーの順序の変更

UITabBarController

プロパティ

プロパティ名 説明
delegate UINavigationController デリゲートを指定する
selectedIndex Int 選択中の画面のインデックス
tabBar UITabBar UITabBarを取得する
viewControllers [ViewController] 管理している画面

メソッド

メソッド名 説明
setViewController(viewControllers: [UIViewController], animated: Bool) 画面を追加する

デリゲートメソッド

メソッド名 説明
tabBarController(_tabBarController: UITabBarController, didSelect viewController: UIViewController) タブが選択された時に呼び出される

UIAlertController

プロパティ

プロパティ名 説明
title String アラートのタイトル
message String アラートのメッセージ
preferredStyle UIAlertController.Style アラートのスタイル

メソッド

メソッド名 説明
addAction(action: UIAlertAction) アラートかアクションシートを加える
addTextField(configurationHandler: ((UITextField)->Void)?) アラートにテキストフィールドを追加

UIImagePickerController

プロパティ

プロパティ名 説明
delegate UIPickerController デリゲートを指定
SourceType UIImagePickerController.Source 画像の取得先を指定(.camera, .photoLibrary, .savedPhotosAlbum)
allowsEditing Bool 取得した画像を編集するかどうか
mediaTypes [String] メディアのタイプ

メソッド

メソッド名 説明
UIImagePickerController.isSourceTypeAvailable(sourceType: UIImagePickerController.SourceType) カメラが使用可能かどうか
UIImageWriteToSavedPhotosAlbum(image: UIImage, completionTarget: Any?, completionSelector: Selector?, contextInfo: UnsafeMutaleRawPointer?) 取得した画像をフォトライブラリに保存する

デリゲートメソッド

メソッド名 説明
imagePickerController(_picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey: Any]) 画像が選択された時の呼ばれる
imagePickerControllerDidCancel(_picker: UIImagePickerController) 画像の選択をキャンセルした時に呼ばれる

UINib

メソッド

メソッド名 説明
init(nibName: String, bundle: Bundle?) UINibの初期値を入れ、作成
instantiate(withOwner ownerOrNil: Any?, options optionsorNil: [UINib.optionsKey: Any]? = nil)->[Any] UINibからViewのインスタンスを生成

UIStoryboard

メソッド

メソッド名 説明
init(name: String, bundle: Bundle?) 指定したファイルのストーリーボードのオブジェクトの生成
instantiateIntialViewController()->UIViewController? 初期のViewControllerを作成しデータの初期化をする

UISlider

プロパティ

プロパティ名 説明
value Float 現在の値
minimumValue Float 最小値
maximumValue Float 最大値
thumbTintColor UIColor 円の色
minimumValueImage UIImage 左に表示する画像
maximumValueImage UIImage 右に表示する画像
minimumTrackTintColor UIColor 左側の線の色
maximumTrackTintColor UIColor 右側の線の色
isContinuous Bool スライド中にイベントを発生させるかどうか
frame CGRect 位置とサイズの指定
center CGPoint 中心位置を指定
bounds CGRect サイズの指定
backgroundColor UIColor 背景色の設定
isHidden Bool 表示非表示を設定
tag Ing タグ付けをする
alpha CGFloat 透過の設定

メソッド

メソッド名 説明
setValue(value: Float, animated: Bool) 値の設定
setThumbImage(image: UIImage, for: UIControl.state) つまみに画像を挿入

UIWindow

プロパティ

プロパティ名 説明
rootViewController UIViewController ウィンドウの初めのコントローラー
window UIWindow.Level ウィンドウの位置

メソッド

メソッド名 説明
makeKeyAndVisible() windowを画面に表示させる

UIScreen

プロパティ

プロパティ名 説明
main UIScreen デバイスの画像を表す
bounds CGRect 画面のサイズ
nativiBounds CGRect 解像度
screens [UIScreen] デバイスに接続されている全ての画面の配列
scale CGFloat 画面の倍率
brightness CGFloat スクリーンの輝度

UIScene

プロパティ

プロパティ名 説明
delegate UISceneDelegate デリゲートを指定

メソッド

メソッド名 説明
func open(URL, options: UIScene.Open ExternalURLOptions?, completionHandler: ((Bool)->Void)?) 指定したURLを開く

デリゲートメソッド

メソッド名 説明
scene(_scene: UIScene, willConnectTo session: UIScene, options connectionOptions: UIScene.ConnectionOptions) シーン起動時に呼ばれる
sceneDidDisconnect(_scene: UIScene) バックグラウンドに入った直後のシーンのセッションが切れた時に呼ばれる
sceneDidBecomeActive(_scene: UIScene) 非アクティブ状態からアクティブになった時に呼ばれる
sceneWillResignActive(_scene: UIScene) 通話などでアクティブ状態から非アクティブ状態に移行する際に呼ばれる
sceneWillEnterForground(_scene: UIScene) シーンがバックグラウンドからフォアグラウンドに移行する時に呼ばれる
sceneDidEnterBackgournd(_scene: UIScene) シーンがフォアグラウンドからバックグラウンドに移行するときに呼ばれる

UIPickerView

プロパティ

プロパティ名 説明
delegate UIPickerDelegate デリゲートを指定
dataSource UIPickerViewDataSource データソースを指定
numberOfComponents Int コンポーネントの数
frame CGRect 位置とサイズの指定
center CGPoint 中心位置を指定
bounds CGRect サイズの指定
backgroundColor UIColor 背景色の設定
isHidden Bool 表示非表示を設定
tag Ing タグ付けをする
alpha CGFloat 透過の設定

メソッド

メソッド名 説明
reloadAllComponents() 全てのコンポーネントを再読み込みする
reloadComponent(Int) 特定のコンポーネントの再読み込みする
selectRow(Int, inComponent: Int, animated: Bool) 特定の行とコンポーネントを指定する

データソースメソッド

メソッド名 説明
numberOfComponents(in pickerView: UIPickerView)->Int コンポーネントの数
pickerView(_pickerView: UIPickerView, numberOfRowsinComponent: Int)->Int 行の数

デリゲートメソッド

メソッド名 説明
pickerView(UIPickerView, titleRow: Int, forComponent: Int)->String それぞれの行にタイトルを表示
pickerView(UIPickerView, didSelectRow: Int, inComponent: Int) 行が選択された時に呼ばれる
pickerView(UIPickerView, rowHeightForComponent: Int)->CGFloat 行の高さを設定
pickerView(UIPickerView, widthForComponent: Int)->CGFloat コンポーネントの横幅を設定
pickerView(UIPickerView, viewForRow: Int, forComponent: Int, resing: UIView)->String 行にUIViewを返す

UIDatePickerView

プロパティ

プロパティ名 説明
datePickerMode UIDatePicker.Mode ピッカーのスタイル(.countDownTime, .date, .dateAndTime, .time)
locale Locale 場所
minuteInterval Int 何分刻みか
date Date 選択中の日時
minimumDate Date 最小日時
maximumDate Date 最大日時
countDownDuration TimeInteval カウントダウンの時間
isEnabled Bool 有効か無効か
frame CGRect 位置とサイズの指定
center CGPoint 中心位置を指定
bounds CGRect サイズの指定
backgroundColor UIColor 背景色の設定
isHidden Bool 表示非表示を設定
tag Ing タグ付けをする
alpha CGFloat 透過の設定

メソッド

メソッド名 説明
setDate(Date, animated: Bool) 指定したDateを表示する

UIProgressView

プロパティ

プロパティ名 説明
progressViewStyle UIProgressView.Style プログレスのスタイル(.default, .bar)
progress Float 進歩状況
progressTintColor UIColor 左側の色
trackTintColor UIColor 右側の色
isEnabled Bool 有効か無効か
frame CGRect 位置とサイズの指定
center CGPoint 中心位置を指定
bounds CGRect サイズの指定
backgroundColor UIColor 背景色の設定
isHidden Bool 表示非表示を設定
tag Ing タグ付けをする
alpha CGFloat 透過の設定

メソッド

メソッド名 説明
setProgress(value: Float, animated: Bool) 値の設定

UIActivityIndicatorView

プロパティ

プロパティ名 説明
hidesWhenStopped Bool アニメーションがストップしたら非表示にするかどうか
isAnimating Bool アニメーションするかどうか
color UIColor インジケーターの色
isEnabled Bool 有効か無効か
style UIActivityIndicatorView.Style インジケーターのスタイル(.large, .medium)
frame CGRect 位置とサイズの指定
center CGPoint 中心位置を指定
bounds CGRect サイズの指定
backgroundColor UIColor 背景色の設定
isHidden Bool 表示非表示を設定
tag Ing タグ付けをする
alpha CGFloat 透過の設定

メソッド

メソッド名 説明
startAnimating() アニメーションの開始
stopAnimating() アニメーションを止める

おわりに

疲れました!笑
よろしければ辞書がわりにご利用ください!

7
14
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
14