图片资源加载

This commit is contained in:
xaoxuu 2020-06-15 18:58:13 +08:00
parent 9003edc359
commit 80a17dc2b8
8 changed files with 106 additions and 32 deletions

View File

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1150"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "ProHUD"
BuildableName = "ProHUD"
BlueprintName = "ProHUD"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "ProHUD"
BuildableName = "ProHUD"
BlueprintName = "ProHUD"
ReferencedContainer = "container:">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -304,7 +304,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0; IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MTL_ENABLE_DEBUG_INFO = YES; MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos; SDKROOT = iphoneos;
@ -358,7 +358,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0; IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MTL_ENABLE_DEBUG_INFO = NO; MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos; SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule; SWIFT_COMPILATION_MODE = wholemodule;

View File

@ -18,12 +18,18 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch. // Override point for customization after application launch.
let vc = RootVC()
window = UIWindow.init(frame: UIScreen.main.bounds) window = UIWindow.init(frame: UIScreen.main.bounds)
window?.rootViewController = RootVC() window?.rootViewController = vc
window?.makeKeyAndVisible() window?.makeKeyAndVisible()
ProHUD.config { (cfg) in ProHUD.config { (cfg) in
cfg.rootViewController = window!.rootViewController cfg.rootViewController = vc
if #available(iOS 13.0, *) {
cfg.windowScene = window?.windowScene
} else {
// Fallback on earlier versions
}
cfg.alert { (a) in cfg.alert { (a) in
a.titleFont = .bold(22) a.titleFont = .bold(22)
a.bodyFont = .regular(17) a.bodyFont = .regular(17)

View File

@ -18,7 +18,11 @@ class RootVC: UIViewController {
let nav = UINavigationController(rootViewController: vc) let nav = UINavigationController(rootViewController: vc)
addChild(nav) addChild(nav)
view.addSubview(nav.view) view.addSubview(nav.view)
if #available(iOS 11.0, *) {
nav.navigationBar.prefersLargeTitles = true nav.navigationBar.prefersLargeTitles = true
} else {
// Fallback on earlier versions
}
} }

View File

@ -5,8 +5,8 @@ target 'Example' do
pod 'ProHUD', :path => '..' pod 'ProHUD', :path => '..'
pod 'SnapKit', '4.2.0' pod 'SnapKit', '5.0.0'
pod 'Inspire', '1.0.5' # :path => '../Inspire' pod 'Inspire', :path => '../../Inspire'
end end

View File

@ -1,29 +1,30 @@
PODS: PODS:
- Inspire (1.0.5) - Inspire (1.1.0)
- ProHUD (1.0): - ProHUD (1.0):
- Inspire - Inspire
- SnapKit (= 4.2.0) - SnapKit (= 5.0)
- SnapKit (4.2.0) - SnapKit (5.0.0)
DEPENDENCIES: DEPENDENCIES:
- Inspire (= 1.0.5) - Inspire (from `../../Inspire`)
- ProHUD (from `..`) - ProHUD (from `..`)
- SnapKit (= 4.2.0) - SnapKit (= 5.0.0)
SPEC REPOS: SPEC REPOS:
https://github.com/cocoapods/specs.git: trunk:
- Inspire
- SnapKit - SnapKit
EXTERNAL SOURCES: EXTERNAL SOURCES:
Inspire:
:path: "../../Inspire"
ProHUD: ProHUD:
:path: ".." :path: ".."
SPEC CHECKSUMS: SPEC CHECKSUMS:
Inspire: fcd7b5ed3b30506b7f04645719b52e0a89884cd4 Inspire: 0beb2517cbf0111fe13c6bb1ab9ea791abd1f42b
ProHUD: 6e5ce4d0599f9b8d2481783368cb08947df7657f ProHUD: 7128b55036885ac4f8b4d0b0783ee6f8eb3a2ea9
SnapKit: fe8a619752f3f27075cc9a90244d75c6c3f27e2a SnapKit: fd22d10eb9aff484d79a8724eab922c1ddf89bcf
PODFILE CHECKSUM: 973ed9d97f2f88c3dde66acf49139682be3748eb PODFILE CHECKSUM: 80148eec6ba2e9631b208c7b277316b6c551afc4
COCOAPODS: 1.7.5 COCOAPODS: 1.9.2

View File

@ -9,8 +9,8 @@ Pod::Spec.new do |s|
s.ios.deployment_target = '10.0' s.ios.deployment_target = '10.0'
s.source_files = 'ProHUD/**/*.swift' s.source_files = 'Source/**/*.swift'
s.resource_bundles = { 'ProHUD' => ['ProHUD/*.{xcassets,strings,xml,storyboard,xib,xcdatamodeld,gif,lproj}'] } s.resource_bundles = { 'ProHUD' => ['Source/**/*.{xcassets,strings,xml,storyboard,xib,xcdatamodeld,gif,lproj}'] }
s.requires_arc = true s.requires_arc = true
s.swift_version = '5.0' s.swift_version = '5.0'

View File

@ -83,17 +83,13 @@ internal extension ProHUD {
/// Bundle /// Bundle
static var bundle: Bundle { static var bundle: Bundle {
var b = Bundle.init(for: Alert.self) let path = Bundle(for: HUDController.self).path(forResource: "ProHUD", ofType: "bundle")
let p = b.path(forResource: "ProHUD", ofType: "bundle") return Bundle(path: path ?? "") ?? Bundle.main
if let bb = Bundle.init(path: p ?? "") {
b = bb
}
return b
} }
/// Image /// Image
static func image(named: String) -> UIImage? { static func image(named: String) -> UIImage? {
return UIImage(named: named) ?? UIImage.init(named: named, in: bundle, compatibleWith: nil) return UIImage(named: named) ?? UIImage(named: named, in: bundle, compatibleWith: nil)
} }