swiftでよくある左端の横三本線を押すとメニューが表示されようなサイドメニューを作っています。
@IBOutlet weak var menuView: SideMenu!の横にUse of undeclared type 'SideMenu'のエラーが出てしまい解決方法がわからないので質問させていただきます。お分かりになる方、助けて頂けたら幸いです。
swift
1import UIKit 2 3class SideMenuController: UIViewController { 4 5 @IBOutlet weak var menuView: SideMenu! 6 7 override func viewDidLoad() { 8 super.viewDidLoad() 9 } 10 11 override func viewWillAppear(_ animated: Bool) { 12 super.viewWillAppear(animated) 13 // メニュー画面の位置 14 let menuPosition = self.menuView.layer.position 15 // 初期位置設定 16 self.menuView.layer.position.x = -self.menuView.frame.width 17 // 表示アニメーション 18 UIView.animate( 19 withDuration: 0.1, 20 delay: 0, 21 options: .curveEaseOut, 22 animations: { 23 self.menuView.layer.position.x = menuPosition.x 24 }, 25 completion: { bool in 26 }) 27 28 } 29 30 // メニュー外をタップした場合に非表示にする 31 override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) { 32 super.touchesEnded(touches, with: event) 33 for touch in touches { 34 if touch.view?.tag == 1 { 35 UIView.animate( 36 withDuration: 0.2, 37 delay: 0, 38 options: .curveEaseIn, 39 animations: { 40 self.menuView.layer.position.x = -self.menuView.frame.width 41 }, 42 completion: { bool in 43 self.dismiss(animated: true, completion: nil) 44 } 45 ) 46 } 47 } 48 } 49 50 override func didReceiveMemoryWarning() { 51 super.didReceiveMemoryWarning() 52 } 53 54} 55
回答1件
あなたの回答
tips
プレビュー