Repository: tungfam/ImageInNavigationBarDemo Branch: master Commit: ded9ae73c812 Files: 14 Total size: 34.2 KB Directory structure: gitextract_svexc16_/ ├── ImageInNavigationBarDemo/ │ ├── AppDelegate.swift │ ├── Assets.xcassets/ │ │ ├── AppIcon.appiconset/ │ │ │ └── Contents.json │ │ ├── Contents.json │ │ └── image_name.imageset/ │ │ └── Contents.json │ ├── Base.lproj/ │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── DemoTableViewController.swift │ └── Info.plist ├── ImageInNavigationBarDemo.xcodeproj/ │ ├── project.pbxproj │ ├── project.xcworkspace/ │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata/ │ │ └── IDEWorkspaceChecks.plist │ └── xcuserdata/ │ └── Tung.xcuserdatad/ │ ├── xcdebugger/ │ │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes/ │ └── xcschememanagement.plist └── README.md ================================================ FILE CONTENTS ================================================ ================================================ FILE: ImageInNavigationBarDemo/AppDelegate.swift ================================================ // // AppDelegate.swift // ImageInNavigationBarDemo // // Created by Tung Fam on 11/14/17. // Copyright © 2017 Tung Fam. All rights reserved. // import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. return true } func applicationWillResignActive(_ application: UIApplication) { // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. } func applicationDidEnterBackground(_ application: UIApplication) { // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. } func applicationWillEnterForeground(_ application: UIApplication) { // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. } func applicationDidBecomeActive(_ application: UIApplication) { // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. } func applicationWillTerminate(_ application: UIApplication) { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } } ================================================ FILE: ImageInNavigationBarDemo/Assets.xcassets/AppIcon.appiconset/Contents.json ================================================ { "images" : [ { "idiom" : "iphone", "size" : "20x20", "scale" : "2x" }, { "idiom" : "iphone", "size" : "20x20", "scale" : "3x" }, { "idiom" : "iphone", "size" : "29x29", "scale" : "2x" }, { "idiom" : "iphone", "size" : "29x29", "scale" : "3x" }, { "idiom" : "iphone", "size" : "40x40", "scale" : "2x" }, { "idiom" : "iphone", "size" : "40x40", "scale" : "3x" }, { "idiom" : "iphone", "size" : "60x60", "scale" : "2x" }, { "idiom" : "iphone", "size" : "60x60", "scale" : "3x" }, { "idiom" : "ipad", "size" : "20x20", "scale" : "1x" }, { "idiom" : "ipad", "size" : "20x20", "scale" : "2x" }, { "idiom" : "ipad", "size" : "29x29", "scale" : "1x" }, { "idiom" : "ipad", "size" : "29x29", "scale" : "2x" }, { "idiom" : "ipad", "size" : "40x40", "scale" : "1x" }, { "idiom" : "ipad", "size" : "40x40", "scale" : "2x" }, { "idiom" : "ipad", "size" : "76x76", "scale" : "1x" }, { "idiom" : "ipad", "size" : "76x76", "scale" : "2x" }, { "idiom" : "ipad", "size" : "83.5x83.5", "scale" : "2x" }, { "idiom" : "ios-marketing", "size" : "1024x1024", "scale" : "1x" } ], "info" : { "version" : 1, "author" : "xcode" } } ================================================ FILE: ImageInNavigationBarDemo/Assets.xcassets/Contents.json ================================================ { "info" : { "version" : 1, "author" : "xcode" } } ================================================ FILE: ImageInNavigationBarDemo/Assets.xcassets/image_name.imageset/Contents.json ================================================ { "images" : [ { "idiom" : "universal", "scale" : "1x" }, { "idiom" : "universal", "filename" : "ca_image.jpg", "scale" : "2x" }, { "idiom" : "universal", "scale" : "3x" } ], "info" : { "version" : 1, "author" : "xcode" } } ================================================ FILE: ImageInNavigationBarDemo/Base.lproj/LaunchScreen.storyboard ================================================ ================================================ FILE: ImageInNavigationBarDemo/Base.lproj/Main.storyboard ================================================ ================================================ FILE: ImageInNavigationBarDemo/DemoTableViewController.swift ================================================ // // DemoTableViewController.swift // ImageInNavigationBarDemo // // Created by Tung Fam on 11/14/17. // Copyright © 2017 Tung Fam. All rights reserved. // import UIKit extension DemoTableViewController { /// WARNING: Change these constants according to your project's design private struct Const { /// Image height/width for Large NavBar state static let ImageSizeForLargeState: CGFloat = 40 /// Margin from right anchor of safe area to right anchor of Image static let ImageRightMargin: CGFloat = 16 /// Margin from bottom anchor of NavBar to bottom anchor of Image for Large NavBar state static let ImageBottomMarginForLargeState: CGFloat = 12 /// Margin from bottom anchor of NavBar to bottom anchor of Image for Small NavBar state static let ImageBottomMarginForSmallState: CGFloat = 6 /// Image height/width for Small NavBar state static let ImageSizeForSmallState: CGFloat = 32 /// Height of NavBar for Small state. Usually it's just 44 static let NavBarHeightSmallState: CGFloat = 44 /// Height of NavBar for Large state. Usually it's just 96.5 but if you have a custom font for the title, please make sure to edit this value since it changes the height for Large state of NavBar static let NavBarHeightLargeState: CGFloat = 96.5 /// Image height/width for Landscape state static let ScaleForImageSizeForLandscape: CGFloat = 0.65 } } final class DemoTableViewController: UITableViewController { private let imageView = UIImageView(image: UIImage(named: "image_name")) private var shouldResize: Bool? // MARK: - Lifecycle override func viewDidLoad() { super.viewDidLoad() setupUI() showTutorialAlert() observeAndHandleOrientationMode() if UIDevice.current.orientation.isPortrait { shouldResize = true } else if UIDevice.current.orientation.isLandscape { shouldResize = false } } override func viewWillDisappear(_ animated: Bool) { super.viewWillDisappear(animated) showImage(false) } override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) showImage(true) } override func viewDidLayoutSubviews() { super.viewDidLayoutSubviews() guard let shouldResize = shouldResize else { assertionFailure("shouldResize wasn't set. reason could be non-handled device orientation state"); return } if shouldResize { moveAndResizeImageForPortrait() } } // MARK: - Scroll View Delegates override func scrollViewDidScroll(_ scrollView: UIScrollView) { guard let shouldResize = shouldResize else { assertionFailure("shouldResize wasn't set. reason could be non-handled device orientation state"); return } if shouldResize { moveAndResizeImageForPortrait() } } // MARK: - Private methods private func setupUI() { navigationController?.navigationBar.prefersLargeTitles = true title = "Resizing image 👉" // Initial setup for image for Large NavBar state since the the screen always has Large NavBar once it gets opened guard let navigationBar = self.navigationController?.navigationBar else { return } navigationBar.addSubview(imageView) imageView.layer.cornerRadius = Const.ImageSizeForLargeState / 2 imageView.clipsToBounds = true imageView.translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint.activate([ imageView.rightAnchor.constraint(equalTo: navigationBar.rightAnchor, constant: -Const.ImageRightMargin), imageView.bottomAnchor.constraint(equalTo: navigationBar.bottomAnchor, constant: -Const.ImageBottomMarginForLargeState), imageView.heightAnchor.constraint(equalToConstant: Const.ImageSizeForLargeState), imageView.widthAnchor.constraint(equalTo: imageView.heightAnchor) ]) } private func observeAndHandleOrientationMode() { NotificationCenter.default.addObserver(forName: NSNotification.Name.UIDeviceOrientationDidChange, object: nil, queue: OperationQueue.current) { [weak self] _ in if UIDevice.current.orientation.isPortrait { self?.title = "Resizing image 👉" self?.moveAndResizeImageForPortrait() self?.shouldResize = true } else if UIDevice.current.orientation.isLandscape { self?.title = "Non 🙅🏽‍♂️ resizing image" self?.resizeImageForLandscape() self?.shouldResize = false } } } private func moveAndResizeImageForPortrait() { guard let height = navigationController?.navigationBar.frame.height else { return } let coeff: CGFloat = { let delta = height - Const.NavBarHeightSmallState let heightDifferenceBetweenStates = (Const.NavBarHeightLargeState - Const.NavBarHeightSmallState) return delta / heightDifferenceBetweenStates }() let factor = Const.ImageSizeForSmallState / Const.ImageSizeForLargeState let scale: CGFloat = { let sizeAddendumFactor = coeff * (1.0 - factor) return min(1.0, sizeAddendumFactor + factor) }() // Value of difference between icons for large and small states let sizeDiff = Const.ImageSizeForLargeState * (1.0 - factor) // 8.0 let yTranslation: CGFloat = { /// This value = 14. It equals to difference of 12 and 6 (bottom margin for large and small states). Also it adds 8.0 (size difference when the image gets smaller size) let maxYTranslation = Const.ImageBottomMarginForLargeState - Const.ImageBottomMarginForSmallState + sizeDiff return max(0, min(maxYTranslation, (maxYTranslation - coeff * (Const.ImageBottomMarginForSmallState + sizeDiff)))) }() let xTranslation = max(0, sizeDiff - coeff * sizeDiff) imageView.transform = CGAffineTransform.identity .scaledBy(x: scale, y: scale) .translatedBy(x: xTranslation, y: yTranslation) } private func resizeImageForLandscape() { let yTranslation = Const.ImageSizeForLargeState * Const.ScaleForImageSizeForLandscape imageView.transform = CGAffineTransform.identity .scaledBy(x: Const.ScaleForImageSizeForLandscape, y: Const.ScaleForImageSizeForLandscape) .translatedBy(x: 0, y: yTranslation) } /// Show or hide the image from NavBar while going to next screen or back to initial screen /// /// - Parameter show: show or hide the image from NavBar private func showImage(_ show: Bool) { UIView.animate(withDuration: 0.2) { self.imageView.alpha = show ? 1.0 : 0.0 } } private func showTutorialAlert() { let alert = UIAlertController(title: "Tutorial", message: "Scroll down and up to resize the image in navigation bar.", preferredStyle: .alert) let okAction = UIAlertAction(title: "Got it!", style: .default) alert.addAction(okAction) present(alert, animated: true) } } extension DemoTableViewController { // MARK: - Table view data source override func numberOfSections(in tableView: UITableView) -> Int { return 3 } override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return 10 } override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "DemoCell", for: indexPath) cell.textLabel?.text = "row \(indexPath.row)" return cell } override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { performSegue(withIdentifier: "SegueID", sender: nil) } } ================================================ FILE: ImageInNavigationBarDemo/Info.plist ================================================ CFBundleDevelopmentRegion $(DEVELOPMENT_LANGUAGE) CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName $(PRODUCT_NAME) CFBundlePackageType APPL CFBundleShortVersionString 1.0 CFBundleVersion 1 LSRequiresIPhoneOS UILaunchStoryboardName LaunchScreen UIMainStoryboardFile Main UIRequiredDeviceCapabilities armv7 UISupportedInterfaceOrientations UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortraitUpsideDown UISupportedInterfaceOrientations~ipad UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight ================================================ FILE: ImageInNavigationBarDemo.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 48; objects = { /* Begin PBXBuildFile section */ A64022B81FBB249000E78BF9 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A64022B71FBB249000E78BF9 /* AppDelegate.swift */; }; A64022BD1FBB249000E78BF9 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A64022BB1FBB249000E78BF9 /* Main.storyboard */; }; A64022BF1FBB249000E78BF9 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A64022BE1FBB249000E78BF9 /* Assets.xcassets */; }; A64022C21FBB249000E78BF9 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A64022C01FBB249000E78BF9 /* LaunchScreen.storyboard */; }; A64022CA1FBB24AA00E78BF9 /* DemoTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A64022C91FBB24AA00E78BF9 /* DemoTableViewController.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ A64022B41FBB249000E78BF9 /* ImageInNavigationBarDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ImageInNavigationBarDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; A64022B71FBB249000E78BF9 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; A64022BC1FBB249000E78BF9 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; A64022BE1FBB249000E78BF9 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; A64022C11FBB249000E78BF9 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; A64022C31FBB249000E78BF9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; A64022C91FBB24AA00E78BF9 /* DemoTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DemoTableViewController.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ A64022B11FBB249000E78BF9 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ A64022AB1FBB249000E78BF9 = { isa = PBXGroup; children = ( A64022B61FBB249000E78BF9 /* ImageInNavigationBarDemo */, A64022B51FBB249000E78BF9 /* Products */, ); sourceTree = ""; }; A64022B51FBB249000E78BF9 /* Products */ = { isa = PBXGroup; children = ( A64022B41FBB249000E78BF9 /* ImageInNavigationBarDemo.app */, ); name = Products; sourceTree = ""; }; A64022B61FBB249000E78BF9 /* ImageInNavigationBarDemo */ = { isa = PBXGroup; children = ( A64022B71FBB249000E78BF9 /* AppDelegate.swift */, A64022C91FBB24AA00E78BF9 /* DemoTableViewController.swift */, A64022BB1FBB249000E78BF9 /* Main.storyboard */, A64022BE1FBB249000E78BF9 /* Assets.xcassets */, A64022C01FBB249000E78BF9 /* LaunchScreen.storyboard */, A64022C31FBB249000E78BF9 /* Info.plist */, ); path = ImageInNavigationBarDemo; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ A64022B31FBB249000E78BF9 /* ImageInNavigationBarDemo */ = { isa = PBXNativeTarget; buildConfigurationList = A64022C61FBB249000E78BF9 /* Build configuration list for PBXNativeTarget "ImageInNavigationBarDemo" */; buildPhases = ( A64022B01FBB249000E78BF9 /* Sources */, A64022B11FBB249000E78BF9 /* Frameworks */, A64022B21FBB249000E78BF9 /* Resources */, ); buildRules = ( ); dependencies = ( ); name = ImageInNavigationBarDemo; productName = ImageInNavigationBarDemo; productReference = A64022B41FBB249000E78BF9 /* ImageInNavigationBarDemo.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ A64022AC1FBB249000E78BF9 /* Project object */ = { isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0910; LastUpgradeCheck = 0910; ORGANIZATIONNAME = "Tung Fam"; TargetAttributes = { A64022B31FBB249000E78BF9 = { CreatedOnToolsVersion = 9.1; ProvisioningStyle = Automatic; }; }; }; buildConfigurationList = A64022AF1FBB249000E78BF9 /* Build configuration list for PBXProject "ImageInNavigationBarDemo" */; compatibilityVersion = "Xcode 8.0"; developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, Base, ); mainGroup = A64022AB1FBB249000E78BF9; productRefGroup = A64022B51FBB249000E78BF9 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( A64022B31FBB249000E78BF9 /* ImageInNavigationBarDemo */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ A64022B21FBB249000E78BF9 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( A64022C21FBB249000E78BF9 /* LaunchScreen.storyboard in Resources */, A64022BF1FBB249000E78BF9 /* Assets.xcassets in Resources */, A64022BD1FBB249000E78BF9 /* Main.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ A64022B01FBB249000E78BF9 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( A64022B81FBB249000E78BF9 /* AppDelegate.swift in Sources */, A64022CA1FBB24AA00E78BF9 /* DemoTableViewController.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ A64022BB1FBB249000E78BF9 /* Main.storyboard */ = { isa = PBXVariantGroup; children = ( A64022BC1FBB249000E78BF9 /* Base */, ); name = Main.storyboard; sourceTree = ""; }; A64022C01FBB249000E78BF9 /* LaunchScreen.storyboard */ = { isa = PBXVariantGroup; children = ( A64022C11FBB249000E78BF9 /* Base */, ); name = LaunchScreen.storyboard; sourceTree = ""; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ A64022C41FBB249000E78BF9 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 11.1; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; }; name = Debug; }; A64022C51FBB249000E78BF9 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 11.1; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; VALIDATE_PRODUCT = YES; }; name = Release; }; A64022C71FBB249000E78BF9 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = YZT3W6BM9X; INFOPLIST_FILE = ImageInNavigationBarDemo/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.mintung.ImageInNavigationBarDemo; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; }; A64022C81FBB249000E78BF9 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = YZT3W6BM9X; INFOPLIST_FILE = ImageInNavigationBarDemo/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.mintung.ImageInNavigationBarDemo; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ A64022AF1FBB249000E78BF9 /* Build configuration list for PBXProject "ImageInNavigationBarDemo" */ = { isa = XCConfigurationList; buildConfigurations = ( A64022C41FBB249000E78BF9 /* Debug */, A64022C51FBB249000E78BF9 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; A64022C61FBB249000E78BF9 /* Build configuration list for PBXNativeTarget "ImageInNavigationBarDemo" */ = { isa = XCConfigurationList; buildConfigurations = ( A64022C71FBB249000E78BF9 /* Debug */, A64022C81FBB249000E78BF9 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = A64022AC1FBB249000E78BF9 /* Project object */; } ================================================ FILE: ImageInNavigationBarDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata ================================================ ================================================ FILE: ImageInNavigationBarDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist ================================================ IDEDidComputeMac32BitWarning ================================================ FILE: ImageInNavigationBarDemo.xcodeproj/xcuserdata/Tung.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist ================================================ ================================================ FILE: ImageInNavigationBarDemo.xcodeproj/xcuserdata/Tung.xcuserdatad/xcschemes/xcschememanagement.plist ================================================ SchemeUserState ImageInNavigationBarDemo.xcscheme orderHint 0 ================================================ FILE: README.md ================================================ # Demo project to build resizing image in Navigation Bar with Large Title (iOS 11+) Demo project that shows the implementation of an image which resizes according to the height of navigation bar with a large title (iOS 11+). ## Tutorial Follow this detailed [tutorial](https://blog.uptech.team/how-to-build-resizing-image-in-navigation-bar-with-large-title-8ba2e8bcb840) to build it in your project. ## Demo