본문 바로가기

전체 글

(46)
[Swift] Google Admob 추가 cocoapod 으로 admob 설치 후. import SnapKit import GoogleMobileAds func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { GADMobileAds.sharedInstance().start(completionHandler: nil) return true } private var bannerView: GADBannerView! override func viewDidLoad() { super.viewDidLoad() let adSize = GADAdSizeFromCGSiz..
[Swift] modalPresentationStyle 코드로 다른 contorller view 를 불러올때, 크기를 이어받을 것인지, 풀로 불러올 것인지 정할 수 있음. 나는 주로 맥북에서 테스트 시에 쓰게 됨. svc.modalPresentationStyle = .currentContext //이전 cv와 동일 svc.modalPresentationStyle = .fullScreen //이전 cv와 상관 없이 풀스크린
[Swift] 작업영역에서 Statusbar 제외하기 아래 코드 참고. import UIKit import SnapKit import Foundation class MyMainView: UIViewController { let safetyArea: UIView = { let v = UIView() return v }() lazy var myButtonTop: UIButton = { let btn = UIButton() btn.setTitle("My Button(T)", for: .normal) btn.backgroundColor = UIColor.blue return btn }() override func viewDidLoad() { super.viewDidLoad() setBaseView() setView() } func setBaseView(){ saf..
[Swift] SnapKit UI를 코드로 편하게 작성하기 위해 사용하는 라이브러리 https://github.com/SnapKit/SnapKit
[Swift] Lazy 변수 불러오기 전까지는 연산되지 않음. 따라서 메모리 절약 가능 Lazy var funcName: ~
[Swift] Storyboard 없이 코드로 프로젝트 시작하기 1. Main.storyboard 삭제 2. Targets -> General 에서 Main Interface 삭제 3. info.plist -> Application Scene Manifest -> Storyboard Name 삭제 4. SceneDelegate -> func scene을 아래 내용으로 대체, ViewController() //시작 뷰 func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { // Use this method to optionally configure and attach the UIWindow `window`..
[Git] Commit 한 사항 수정하기. commit 수정할 때 1. 코드 내용 수정 2. git add . 3. git commit --amend
[Swift] UI 화면 안나타남 에러 내용 The app delegate must implement the window property if it wants to use a main storyboard file class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? ... 위와 같이 AppDelegate 파일 클래스 안쪽에 var window: UIWindow? 를 추가 해 준다.