https://github.com/shin8484/PopupWindow
ここのURLにあるものです。
特にReadMeにある、Exampleと書かれている様な、ポップアップが出てきてそこにボタンなどを配置したいです。
しかしReadMeにあるUsageUsageの説明がよく分かりません。
Swift
1PopupWindowManager.shared.changeKeyWindow(rootViewController: UIViewController())
の追加が必要とありますが、これはどこに追加するのでしょうか?viewDidLoad()以下でいいのでしょうか?その下に、Viewcontrollerに以下、
swift
1 let popupOption = PopupOption(shapeType: .roundedCornerTop(cornerSize: 8), viewType: .toast, direction: .bottom) 2 let popupItem = PopupItem(view: loginView, 3 height: Const.firstViewFrame.height, 4 maxWidth: 500, 5 popupOption: popupOption)
を追加するとのことなので、追加した所、Use of unresolved identifier 'PopupOption'やUse of unresolved identifier 'loginView'の様なエラーが出ています。
Swift自体久々で初歩的なミス等をしている可能性はありますが、回答お願いいたします。
因みにViewcontrollerのファイルは以下の様にした所上記の様なエラーが出ています。
swift
1import UIKit 2import PopupWindow 3 4class MainpageViewController: UIViewController { 5 6 override func viewDidLoad() { 7 super.viewDidLoad() 8 9 // Do any additional setup after loading the view. 10 11 PopupWindowManager.shared.changeKeyWindow(rootViewController: UIViewController()) 12 let popupOption = PopupOption(shapeType: .roundedCornerTop(cornerSize: 8), viewType: .toast, direction: .bottom) 13 let popupItem = PopupItem(view: loginView, 14 height: Const.firstViewFrame.height, 15 maxWidth: 500, 16 popupOption: popupOption) 17 18 19 20 21 22 } 23 24 override func didReceiveMemoryWarning() { 25 super.didReceiveMemoryWarning() 26 // Dispose of any resources that can be recreated. 27 } 28 29 30 /* 31 // MARK: - Navigation 32 33 // In a storyboard-based application, you will often want to do a little preparation before navigation 34 override func prepare(for segue: UIStoryboardSegue, sender: Any?) { 35 // Get the new view controller using segue.destinationViewController. 36 // Pass the selected object to the new view controller. 37 } 38 */ 39 40}
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/08/28 10:25