Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ACTabScrollView.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = "ACTabScrollView"
s.version = "0.3.0"
s.version = "0.4.0"
s.summary = "A fancy `Menu` and `Pager` UI extends `UIScrollView` with elegant, smooth and synchronized scrolling `tabs`."

s.description = <<-DESC
Expand All @@ -11,7 +11,7 @@ Pod::Spec.new do |s|
s.homepage = "https://github.com/azurechen/ACTabScrollView"
s.license = "MIT"
s.author = { "Azure Chen" => "[email protected]" }
s.source = { :git => "https://github.com/azurechen/ACTabScrollView.git", :tag => "v0.3.0" }
s.source = { :git => "https://github.com/azurechen/ACTabScrollView.git", :tag => "v0.4.0" }
s.platforms = { :ios => "8.0" }

s.source_files = "Sources/**/*.swift"
Expand Down
9 changes: 5 additions & 4 deletions ACTabScrollView.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
Base,
);
Expand Down Expand Up @@ -402,7 +403,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.azurechen.ACTabScrollView;
PRODUCT_NAME = ACTabScrollView;
PROVISIONING_PROFILE = "";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -419,7 +420,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.azurechen.ACTabScrollView;
PRODUCT_NAME = ACTabScrollView;
PROVISIONING_PROFILE = "";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -439,7 +440,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.azurechen.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = ACTabScrollView;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ACTabScrollView.app/ACTabScrollView";
};
name = Debug;
Expand All @@ -456,7 +457,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.azurechen.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = ACTabScrollView;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ACTabScrollView.app/ACTabScrollView";
};
name = Release;
Expand Down
2 changes: 1 addition & 1 deletion ACTabScrollView/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
Expand Down
22 changes: 13 additions & 9 deletions ACTabScrollView/Base.lproj/LaunchScreen.xib
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9531" systemVersion="14F1605" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina5_9" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
Expand All @@ -11,20 +15,20 @@
<rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Copyright (c) 2015年 AzureChen. All rights reserved." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye">
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" text=" Copyright (c) 2015年 AzureChen. All rights reserved." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye">
<rect key="frame" x="20" y="439" width="441" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="ACTabScrollView" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" text="ACTabScrollView" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
<rect key="frame" x="20" y="140" width="441" height="43"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="kId-c2-rCX" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="bottom" multiplier="1/3" constant="1" id="5cJ-9S-tgC"/>
<constraint firstAttribute="centerX" secondItem="kId-c2-rCX" secondAttribute="centerX" id="Koa-jz-hwk"/>
Expand Down
11 changes: 5 additions & 6 deletions ACTabScrollView/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="VUE-f8-3s2">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="VUE-f8-3s2">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13527"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
Expand Down Expand Up @@ -51,13 +50,13 @@
</variation>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Nbr-9R-GKx">
<rect key="frame" x="111" y="16" width="249" height="43"/>
<rect key="frame" x="111" y="16" width="249" height="43.5"/>
<fontDescription key="fontDescription" type="system" weight="thin" pointSize="17"/>
<color key="textColor" red="0.29019607843137252" green="0.29803921568627451" blue="0.31764705882352939" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" verticalHuggingPriority="251" verticalCompressionResistancePriority="751" translatesAutoresizingMaskIntoConstraints="NO" id="rtq-l3-kbv">
<rect key="frame" x="111" y="63" width="79" height="26"/>
<rect key="frame" x="111" y="63.5" width="79" height="26"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="252" verticalCompressionResistancePriority="751" text="category" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="YZq-CT-JLB">
<rect key="frame" x="8" y="4" width="63" height="18"/>
Expand Down Expand Up @@ -200,7 +199,7 @@
<!--Demo View Controller-->
<scene sceneID="9CW-yv-7Bo">
<objects>
<viewController automaticallyAdjustsScrollViewInsets="NO" id="S0q-1n-yhF" customClass="DemoViewController" customModule="ACTabScrollView" customModuleProvider="target" sceneMemberID="viewController">
<viewController storyboardIdentifier="DemoViewController" automaticallyAdjustsScrollViewInsets="NO" id="S0q-1n-yhF" customClass="DemoViewController" customModule="ACTabScrollView" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="OVf-3x-AtA"/>
<viewControllerLayoutGuide type="bottom" id="14B-mi-1zy"/>
Expand Down
2 changes: 1 addition & 1 deletion ACTabScrollView/ContentViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ContentViewController: UIViewController, UITableViewDelegate, UITableViewD
override func viewDidLoad() {
super.viewDidLoad()

tableView.rowHeight = UITableViewAutomaticDimension
tableView.rowHeight = UITableView.automaticDimension
tableView.estimatedRowHeight = 44
tableView.delegate = self
tableView.dataSource = self
Expand Down
10 changes: 7 additions & 3 deletions ACTabScrollView/NewsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class NewsViewController: UIViewController, ACTabScrollViewDelegate, ACTabScroll
let vc = storyboard.instantiateViewController(withIdentifier: "ContentViewController") as! ContentViewController
vc.category = category

addChildViewController(vc) // don't forget, it's very important
addChild(vc) // don't forget, it's very important
contentViews.append(vc.view)
}

Expand All @@ -45,11 +45,15 @@ class NewsViewController: UIViewController, ACTabScrollViewDelegate, ACTabScroll
navigationBar.isTranslucent = false
navigationBar.tintColor = UIColor.white
navigationBar.barTintColor = UIColor(red: 38.0 / 255, green: 191.0 / 255, blue: 140.0 / 255, alpha: 1)
navigationBar.titleTextAttributes = NSDictionary(object: UIColor.white, forKey: NSAttributedStringKey.foregroundColor as NSCopying) as? [NSAttributedStringKey : AnyObject]
navigationBar.titleTextAttributes = NSDictionary(object: UIColor.white, forKey: NSAttributedString.Key.foregroundColor as NSCopying) as? [NSAttributedString.Key : AnyObject]
navigationBar.setBackgroundImage(UIImage(), for: UIBarMetrics.default)
navigationBar.shadowImage = UIImage()
}
UIApplication.shared.statusBarStyle = UIStatusBarStyle.lightContent

}

override var preferredStatusBarStyle : UIStatusBarStyle {
return .lightContent
}

// MARK: ACTabScrollViewDelegate
Expand Down
11 changes: 7 additions & 4 deletions Sources/ACTabScrollView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,10 @@ open class ACTabScrollView: UIView, UIScrollViewDelegate {

fileprivate func currentPageIndex() -> Int {
let width = self.frame.width
var currentPageIndex = Int((contentSectionScrollView.contentOffset.x + (0.5 * width)) / width)
var currentPageIndex = 0
if width != 0 {
currentPageIndex = Int(( contentSectionScrollView.contentOffset.x + (0.5 * width)) / width)
}
if (currentPageIndex < 0) {
currentPageIndex = 0
} else if (currentPageIndex >= self.numberOfPages) {
Expand Down Expand Up @@ -406,7 +409,7 @@ open class ACTabScrollView: UIView, UIScrollViewDelegate {

if let tab = self.cachedPageTabs[i] {
if (animated) {
UIView.animate(withDuration: 0.5, delay: 0, options: UIViewAnimationOptions.allowUserInteraction, animations: {
UIView.animate(withDuration: 0.5, delay: 0, options: UIView.AnimationOptions.allowUserInteraction, animations: {
tab.alpha = alpha
return
}, completion: nil)
Expand Down Expand Up @@ -500,7 +503,7 @@ public struct CacheQueue<Key: Hashable, Value> {
}
set {
// key/value pair exists, delete it first
if let index = keys.index(of: key) {
if let index = keys.firstIndex(of: key) {
keys.remove(at: index)
}
// append key
Expand All @@ -513,7 +516,7 @@ public struct CacheQueue<Key: Hashable, Value> {
}

mutating func awake(_ key: Key) {
if let index = keys.index(of: key) {
if let index = keys.firstIndex(of: key) {
keys.remove(at: index)
keys.append(key)
}
Expand Down