Skip to content

Commit

Permalink
第四天的学习
Browse files Browse the repository at this point in the history
  • Loading branch information
qianyb committed Dec 22, 2018
1 parent 94f9b47 commit 1fb9c8d
Show file tree
Hide file tree
Showing 5 changed files with 143 additions and 76 deletions.
29 changes: 23 additions & 6 deletions Project 04 - SnapChatMenu/Snapchat Menu.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
9FC2DE2E1C425AF100F0CB8D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9FC2DE2C1C425AF100F0CB8D /* Main.storyboard */; };
9FC2DE331C425AF100F0CB8D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9FC2DE321C425AF100F0CB8D /* Assets.xcassets */; };
9FC2DE361C425AF100F0CB8D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9FC2DE341C425AF100F0CB8D /* LaunchScreen.storyboard */; };
9FC2DE5B1C42675C00F0CB8D /* LeftView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FC2DE591C42675C00F0CB8D /* LeftView.swift */; };
9FC2DE5C1C42675C00F0CB8D /* LeftView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9FC2DE5A1C42675C00F0CB8D /* LeftView.xib */; };
9FC2DE5F1C42676800F0CB8D /* RightView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FC2DE5D1C42676800F0CB8D /* RightView.swift */; };
9FC2DE601C42676800F0CB8D /* RightView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9FC2DE5E1C42676800F0CB8D /* RightView.xib */; };
Expand All @@ -28,7 +27,6 @@
9FC2DE321C425AF100F0CB8D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
9FC2DE351C425AF100F0CB8D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
9FC2DE371C425AF100F0CB8D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
9FC2DE591C42675C00F0CB8D /* LeftView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LeftView.swift; sourceTree = "<group>"; };
9FC2DE5A1C42675C00F0CB8D /* LeftView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = LeftView.xib; sourceTree = "<group>"; };
9FC2DE5D1C42676800F0CB8D /* RightView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RightView.swift; sourceTree = "<group>"; };
9FC2DE5E1C42676800F0CB8D /* RightView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RightView.xib; sourceTree = "<group>"; };
Expand Down Expand Up @@ -68,7 +66,6 @@
children = (
9FC2DE281C425AF100F0CB8D /* AppDelegate.swift */,
9FC2DE2A1C425AF100F0CB8D /* ViewController.swift */,
9FC2DE591C42675C00F0CB8D /* LeftView.swift */,
9FC2DE5A1C42675C00F0CB8D /* LeftView.xib */,
9FC2DE611C426A9500F0CB8D /* CameraView.swift */,
9FC2DE621C426A9500F0CB8D /* CameraView.xib */,
Expand Down Expand Up @@ -109,7 +106,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0720;
LastUpgradeCheck = 0720;
LastUpgradeCheck = 1010;
ORGANIZATIONNAME = Allen;
TargetAttributes = {
9FC2DE241C425AF100F0CB8D = {
Expand Down Expand Up @@ -162,7 +159,6 @@
9FC2DE291C425AF100F0CB8D /* AppDelegate.swift in Sources */,
9FC2DE5F1C42676800F0CB8D /* RightView.swift in Sources */,
9FC2DE631C426A9500F0CB8D /* CameraView.swift in Sources */,
9FC2DE5B1C42675C00F0CB8D /* LeftView.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -196,20 +192,30 @@
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_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
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_IMPLICIT_RETAIN_SELF = 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_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = NO;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
Expand Down Expand Up @@ -240,13 +246,23 @@
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_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
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_IMPLICIT_RETAIN_SELF = 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_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
Expand All @@ -266,6 +282,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 9.2;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
VALIDATE_PRODUCT = YES;
};
name = Release;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1010"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9FC2DE241C425AF100F0CB8D"
BuildableName = "Snapchat Menu.app"
BlueprintName = "Snapchat Menu"
ReferencedContainer = "container:Snapchat Menu.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9FC2DE241C425AF100F0CB8D"
BuildableName = "Snapchat Menu.app"
BlueprintName = "Snapchat Menu"
ReferencedContainer = "container:Snapchat Menu.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</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">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9FC2DE241C425AF100F0CB8D"
BuildableName = "Snapchat Menu.app"
BlueprintName = "Snapchat Menu"
ReferencedContainer = "container:Snapchat Menu.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9FC2DE241C425AF100F0CB8D"
BuildableName = "Snapchat Menu.app"
BlueprintName = "Snapchat Menu"
ReferencedContainer = "container:Snapchat Menu.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
36 changes: 0 additions & 36 deletions Project 04 - SnapChatMenu/Snapchat Menu/LeftView.swift

This file was deleted.

40 changes: 19 additions & 21 deletions Project 04 - SnapChatMenu/Snapchat Menu/LeftView.xib
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,26 @@
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="LeftView" customModule="Snapchat_Menu" customModuleProvider="target">
<connections>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="LeftView" customModule="Snapchat_Menu" customModuleProvider="target"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="left" translatesAutoresizingMaskIntoConstraints="NO" id="0IW-8P-3mw">
<rect key="frame" x="0.0" y="0.0" width="380" height="667"/>
</imageView>
</subviews>
<color key="backgroundColor" red="0.93551886081695557" green="0.99311769008636475" blue="0.039463751018047333" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="0IW-8P-3mw" secondAttribute="bottom" id="NPD-ZW-Q3A"/>
<constraint firstItem="0IW-8P-3mw" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" id="Pnd-cI-LKB"/>
<constraint firstAttribute="trailing" secondItem="0IW-8P-3mw" secondAttribute="trailing" constant="-5" id="rK8-Tl-pG7"/>
<constraint firstItem="0IW-8P-3mw" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="zJC-c6-Z4d"/>
</constraints>
</view>
<viewController id="300-HD-E1F">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="8oY-Pp-vEM"/>
<viewControllerLayoutGuide type="bottom" id="I8O-s6-pos"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="hwg-7T-DKX">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="left" translatesAutoresizingMaskIntoConstraints="NO" id="j9A-aT-hB0">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</imageView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
<point key="canvasLocation" x="-71" y="-338"/>
</viewController>
</objects>
<resources>
<image name="left" width="320" height="568"/>
Expand Down
23 changes: 10 additions & 13 deletions Project 04 - SnapChatMenu/Snapchat Menu/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,21 @@ class ViewController: UIViewController {

// 已经废弃了,使用prefersStatusBarHidden属性返回设置的值
// UIApplication.shared.isStatusBarHidden = true
let leftView: LeftView = LeftView(nibName: "LeftView", bundle: nil)

let screenWidth = UIScreen.main.bounds.width
let screenHeight = UIScreen.main.bounds.height
let leftView: UIViewController = UINib(nibName: "LeftView", bundle: nil).instantiate(withOwner: nil, options: nil)[0] as! UIViewController
let centerView: CameraView = CameraView(nibName: "CameraView", bundle: nil)
let rightView: RightView = RightView(nibName: "RightView", bundle: nil)


leftView.view.frame = CGRect(x: 0, y: 0, width: screenWidth-200, height: screenHeight)
centerView.view.frame = CGRect(x: screenWidth, y: 0, width: screenWidth, height: screenHeight)
rightView.view.frame = CGRect(x: 2*screenWidth, y: 0, width: screenWidth, height: screenHeight)

self.scrollView.addSubview(leftView.view)
self.scrollView.addSubview(rightView.view)
self.scrollView.addSubview(centerView.view)

var centerViewFrame: CGRect = centerView.view.frame
centerViewFrame.origin.x = self.view.frame.width
centerView.view.frame = centerViewFrame

var rightViewFrame: CGRect = rightView.view.frame
rightViewFrame.origin.x = 2 * self.view.frame.width
rightView.view.frame = rightViewFrame

self.scrollView.contentSize = CGSize(width: self.view.frame.width * 3, height: self.view.frame.size.height)

self.scrollView.contentSize = CGSize(width: screenWidth * 3, height: screenHeight)
}

override func didReceiveMemoryWarning() {
Expand Down

0 comments on commit 1fb9c8d

Please sign in to comment.