Skip to content

Commit d5c3676

Browse files
authored
Merge pull request #4 from iOS-Swift-Developers/master
同步更新
2 parents 318e160 + 261a083 commit d5c3676

File tree

839 files changed

+77725
-3
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

839 files changed

+77725
-3
lines changed

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ Swift基本语法思维导图:
5151
- 闭包补充
5252
- 异常处理
5353

54-
### 实战篇 - 直播项目 (UIKit 和 UIFoundation)
55-
54+
实战篇 - 直播项目 (UIKit 和 UIFoundation)
55+
===
5656
实战项目搭建如下脑图:
5757

5858
![实战项目架构图](https://github.com/iOS-Swift-Developers/Swift/blob/master/%E5%AE%9E%E6%88%98%E9%A1%B9%E7%9B%AE%E6%9E%B6%E6%9E%84%E5%9B%BE.png?raw=true)
@@ -62,9 +62,13 @@ Swift基本语法思维导图:
6262

6363
- OOP到POP
6464
- 粒子动画&面向协议
65+
- JQPageView
66+
- 瀑布流
67+
- GPUImage-滤镜美颜相机毛玻璃
68+
- GPUImage-视频采集
6569

6670
### 今日更新
67-
- 粒子动画&面向协议
71+
- 2017.07.24 GPUImage-视频采集
6872

6973
## 更新中...
7074
###### Tips: UIKit 和 UIFoundation 部分接下来会通过 直播实战项目逐步学习!
195 KB
Loading

实战前技术点/3.JQPageView/JQPageView.xcodeproj/project.pbxproj

Lines changed: 588 additions & 0 deletions
Large diffs are not rendered by default.

实战前技术点/3.JQPageView/JQPageView.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
//
2+
// AppDelegate.swift
3+
// JQPageView
4+
//
5+
// Created by 韩俊强 on 2017/7/18.
6+
// Copyright © 2017年 HaRi. All rights reserved.
7+
//
8+
9+
import UIKit
10+
11+
@UIApplicationMain
12+
class AppDelegate: UIResponder, UIApplicationDelegate {
13+
14+
var window: UIWindow?
15+
16+
17+
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
18+
// Override point for customization after application launch.
19+
return true
20+
}
21+
22+
func applicationWillResignActive(_ application: UIApplication) {
23+
// 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.
24+
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
25+
}
26+
27+
func applicationDidEnterBackground(_ application: UIApplication) {
28+
// 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.
29+
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
30+
}
31+
32+
func applicationWillEnterForeground(_ application: UIApplication) {
33+
// 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.
34+
}
35+
36+
func applicationDidBecomeActive(_ application: UIApplication) {
37+
// 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.
38+
}
39+
40+
func applicationWillTerminate(_ application: UIApplication) {
41+
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
42+
}
43+
44+
45+
}
46+
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "iphone",
5+
"size" : "29x29",
6+
"scale" : "2x"
7+
},
8+
{
9+
"idiom" : "iphone",
10+
"size" : "29x29",
11+
"scale" : "3x"
12+
},
13+
{
14+
"idiom" : "iphone",
15+
"size" : "40x40",
16+
"scale" : "2x"
17+
},
18+
{
19+
"idiom" : "iphone",
20+
"size" : "40x40",
21+
"scale" : "3x"
22+
},
23+
{
24+
"idiom" : "iphone",
25+
"size" : "60x60",
26+
"scale" : "2x"
27+
},
28+
{
29+
"idiom" : "iphone",
30+
"size" : "60x60",
31+
"scale" : "3x"
32+
},
33+
{
34+
"idiom" : "ipad",
35+
"size" : "29x29",
36+
"scale" : "1x"
37+
},
38+
{
39+
"idiom" : "ipad",
40+
"size" : "29x29",
41+
"scale" : "2x"
42+
},
43+
{
44+
"idiom" : "ipad",
45+
"size" : "40x40",
46+
"scale" : "1x"
47+
},
48+
{
49+
"idiom" : "ipad",
50+
"size" : "40x40",
51+
"scale" : "2x"
52+
},
53+
{
54+
"idiom" : "ipad",
55+
"size" : "76x76",
56+
"scale" : "1x"
57+
},
58+
{
59+
"idiom" : "ipad",
60+
"size" : "76x76",
61+
"scale" : "2x"
62+
}
63+
],
64+
"info" : {
65+
"version" : 1,
66+
"author" : "xcode"
67+
}
68+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11134" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
3+
<dependencies>
4+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11106"/>
5+
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
6+
</dependencies>
7+
<scenes>
8+
<!--View Controller-->
9+
<scene sceneID="EHf-IW-A2E">
10+
<objects>
11+
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
12+
<layoutGuides>
13+
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
14+
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
15+
</layoutGuides>
16+
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
17+
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
18+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
19+
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
20+
</view>
21+
</viewController>
22+
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
23+
</objects>
24+
<point key="canvasLocation" x="53" y="375"/>
25+
</scene>
26+
</scenes>
27+
</document>
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="rtY-Zs-RYT">
3+
<device id="retina4_7" orientation="portrait">
4+
<adaptation id="fullscreen"/>
5+
</device>
6+
<dependencies>
7+
<deployment identifier="iOS"/>
8+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
9+
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
10+
</dependencies>
11+
<scenes>
12+
<!--JQPageView-->
13+
<scene sceneID="tne-QT-ifu">
14+
<objects>
15+
<viewController id="BYZ-38-t0r" customClass="ViewController" customModule="JQPageView" customModuleProvider="target" sceneMemberID="viewController">
16+
<layoutGuides>
17+
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
18+
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
19+
</layoutGuides>
20+
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
21+
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
22+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
23+
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
24+
</view>
25+
<navigationItem key="navigationItem" title="JQPageView" id="Lru-co-774"/>
26+
</viewController>
27+
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
28+
</objects>
29+
<point key="canvasLocation" x="1079.2" y="137.18140929535232"/>
30+
</scene>
31+
<!--Navigation Controller-->
32+
<scene sceneID="Pe6-Gb-OLe">
33+
<objects>
34+
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="rtY-Zs-RYT" sceneMemberID="viewController">
35+
<toolbarItems/>
36+
<navigationBar key="navigationBar" contentMode="scaleToFill" id="wpt-yv-jO9">
37+
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
38+
<autoresizingMask key="autoresizingMask"/>
39+
</navigationBar>
40+
<nil name="viewControllers"/>
41+
<connections>
42+
<segue destination="BYZ-38-t0r" kind="relationship" relationship="rootViewController" id="dfD-9q-A3F"/>
43+
</connections>
44+
</navigationController>
45+
<placeholder placeholderIdentifier="IBFirstResponder" id="ok1-lx-wFg" userLabel="First Responder" sceneMemberID="firstResponder"/>
46+
</objects>
47+
<point key="canvasLocation" x="356" y="137"/>
48+
</scene>
49+
</scenes>
50+
</document>
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>en</string>
7+
<key>CFBundleExecutable</key>
8+
<string>$(EXECUTABLE_NAME)</string>
9+
<key>CFBundleIdentifier</key>
10+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11+
<key>CFBundleInfoDictionaryVersion</key>
12+
<string>6.0</string>
13+
<key>CFBundleName</key>
14+
<string>$(PRODUCT_NAME)</string>
15+
<key>CFBundlePackageType</key>
16+
<string>APPL</string>
17+
<key>CFBundleShortVersionString</key>
18+
<string>1.0</string>
19+
<key>CFBundleVersion</key>
20+
<string>1</string>
21+
<key>LSRequiresIPhoneOS</key>
22+
<true/>
23+
<key>UILaunchStoryboardName</key>
24+
<string>LaunchScreen</string>
25+
<key>UIMainStoryboardFile</key>
26+
<string>Main</string>
27+
<key>UIRequiredDeviceCapabilities</key>
28+
<array>
29+
<string>armv7</string>
30+
</array>
31+
<key>UISupportedInterfaceOrientations</key>
32+
<array>
33+
<string>UIInterfaceOrientationPortrait</string>
34+
<string>UIInterfaceOrientationLandscapeLeft</string>
35+
<string>UIInterfaceOrientationLandscapeRight</string>
36+
</array>
37+
<key>UISupportedInterfaceOrientations~ipad</key>
38+
<array>
39+
<string>UIInterfaceOrientationPortrait</string>
40+
<string>UIInterfaceOrientationPortraitUpsideDown</string>
41+
<string>UIInterfaceOrientationLandscapeLeft</string>
42+
<string>UIInterfaceOrientationLandscapeRight</string>
43+
</array>
44+
</dict>
45+
</plist>
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
//
2+
// JQContentFlowLayout.swift
3+
// JQPageView
4+
//
5+
// Created by 韩俊强 on 2017/7/19.
6+
// Copyright © 2017年 HaRi. All rights reserved.
7+
//
8+
9+
import UIKit
10+
11+
class JQContentFlowLayout: UICollectionViewFlowLayout {
12+
13+
var cols : Int = 4
14+
var rows : Int = 2
15+
16+
private lazy var attrsArray : [UICollectionViewLayoutAttributes] = [UICollectionViewLayoutAttributes]()
17+
private lazy var maxW : CGFloat = 0
18+
19+
override func prepare() {
20+
super.prepare()
21+
22+
let itemW = (collectionView!.bounds.width - sectionInset.left - sectionInset.right - (CGFloat(cols) - 1) * minimumInteritemSpacing) / CGFloat(cols)
23+
let itemH = (collectionView!.bounds.height - sectionInset.top - sectionInset.bottom - CGFloat(rows - 1) * minimumLineSpacing) / CGFloat(rows)
24+
25+
// 1.获取数据的多少组
26+
let sectionCount = collectionView!.numberOfSections
27+
28+
// 2.给每组数据进行布局
29+
var pageNum = 0
30+
for section in 0..<sectionCount {
31+
let itemCount = collectionView!.numberOfItems(inSection: section)
32+
for item in 0..<itemCount {
33+
let indexPath = IndexPath(item: item, section: section)
34+
let attrs = UICollectionViewLayoutAttributes(forCellWith: indexPath)
35+
36+
let page = item / (cols * rows)
37+
let index = item % (cols * rows)
38+
39+
let x = (sectionInset.left + CGFloat(index % cols) * (itemW + minimumInteritemSpacing)) + collectionView!.bounds.width * CGFloat((page + pageNum))
40+
let y = sectionInset.top + CGFloat(index / cols) * (itemH + minimumLineSpacing)
41+
42+
attrs.frame = CGRect(x: x, y: y, width: itemW, height: itemH)
43+
44+
attrsArray.append(attrs)
45+
}
46+
47+
let sectionNum = (itemCount - 1) / (cols * rows) + 1
48+
49+
pageNum += sectionNum
50+
}
51+
52+
// 3.计算最大的width
53+
maxW = CGFloat(pageNum) * collectionView!.bounds.width
54+
}
55+
56+
override func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? {
57+
return attrsArray
58+
}
59+
60+
override var collectionViewContentSize: CGSize {
61+
return CGSize(width: maxW, height: 0)
62+
}
63+
}

0 commit comments

Comments
 (0)