반응형
방법1 :
self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
self.navigationController?.navigationBar.shadowImage = UIImage()
self.navigationController?.navigationBar.isTranslucent = true
self.navigationController?.view.backgroundColor = .clear
방법2 :
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
// Sets background to a blank/empty image
UINavigationBar.appearance().setBackgroundImage(UIImage(), for: .default)
// Sets shadow (line below the bar) to a blank image
UINavigationBar.appearance().shadowImage = UIImage()
// Sets the translucent background color
UINavigationBar.appearance().backgroundColor = .clear
// Set translucent. (Default value is already true, so this can be removed if desired.)
UINavigationBar.appearance().isTranslucent = true
return true
}
방법3 :
extension UINavigationBar {
func transparentNavigationBar() {
self.setBackgroundImage(UIImage(), for: .default)
self.shadowImage = UIImage()
self.isTranslucent = true
}
}
방법4 :
let navBarAppearance = UINavigationBar.appearance()
let colorImage = UIImage.imageFromColor(UIColor.morselPink(), frame: CGRectMake(0, 0, 340, 64))
navBarAppearance.setBackgroundImage(colorImage, forBarMetrics: .Default)
imageFromColor(color: UIColor, frame: CGRect) -> UIImage {
UIGraphicsBeginImageContextWithOptions(frame.size, false, 0)
color.setFill()
UIRectFill(frame)
let image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return image
}
2020/05/29 - [개발툴/Xcode] - NFC Xcode 설정
2020/05/29 - [개발노트] - NFC (Near Field Communication)
2020/05/29 - [개발노트] - NFC Tag 저장용량
2020/05/29 - [iOS/Swift] - 클로저(Closure)
2020/05/29 - [개발노트] - QR 코드 결제 타입
2020/05/29 - [iOS/Objective-C] - Objective-C Block Syntax
2020/05/29 - [iOS/Objective-C] - Detect permission of camera in iOS
2020/05/29 - [iOS/Swift] - WKWebView에서 history back 처리
2020/05/29 - [iOS/Objective-C] - OpenGL ES View Snapshot
2020/05/29 - [iOS/Objective-C] - Merge two different images in swift
2020/05/29 - [프로그래밍/C, C++] - Base64 encode / decode in C++
2020/05/29 - [OS/Mac OS X] - iPhone SDK location on hard drive
반응형
'개발 > iOS' 카테고리의 다른 글
WKWebView에서 로컬 웹 파일 및 리소스 로드 (0) | 2020.06.01 |
---|---|
WKWebView (0) | 2020.06.01 |
클로저(Closure) (0) | 2020.05.29 |
Objective-C Block Syntax (0) | 2020.05.29 |
Detect permission of camera in iOS (0) | 2020.05.29 |