Skip to content

Commit

Permalink
Fix followers movement
Browse files Browse the repository at this point in the history
  • Loading branch information
andreamazz committed Sep 14, 2018
1 parent abf3f72 commit b7a6b31
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
12 changes: 6 additions & 6 deletions Demo/ScrollingNavbarDemo/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="8DR-mA-2ri">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14313.18" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="8DR-mA-2ri">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14283.14"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
Expand Down Expand Up @@ -305,7 +305,7 @@
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="eSE-Ii-0ph">
<rect key="frame" x="39" y="49" width="42" height="21"/>
<rect key="frame" x="39" y="49.5" width="42" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
Expand Down Expand Up @@ -408,7 +408,7 @@
<toolbar opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="LPu-kw-Ree">
<rect key="frame" x="0.0" y="64" width="375" height="44"/>
<constraints>
<constraint firstAttribute="height" constant="44" id="Er7-I2-hJM"/>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="44" id="MqO-9Z-us4"/>
</constraints>
<items>
<barButtonItem style="plain" systemItem="flexibleSpace" id="O2a-fR-Fq9"/>
Expand Down Expand Up @@ -460,7 +460,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="bsw-3h-r3j">
<rect key="frame" x="160" y="318" width="54" height="30"/>
<rect key="frame" x="160.5" y="318.5" width="54" height="30"/>
<state key="normal" title="Dismiss"/>
<connections>
<action selector="dismiss" destination="edW-ed-vpb" eventType="touchUpInside" id="fb0-8D-pIO"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@
"idiom" : "ipad",
"filename" : "AMScrollingNavbar-167.png",
"scale" : "2x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"scale" : "1x"
}
],
"info" : {
Expand Down
8 changes: 7 additions & 1 deletion Source/ScrollingNavigationController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,13 @@ open class ScrollingNavigationController: UINavigationController, UIGestureRecog
// Account for the safe area for footers and toolbars at the bottom of the screen
safeArea = ($0.direction == .scrollDown) ? (topViewController?.view.safeAreaInsets.bottom ?? 0) : 0
}
$0.view?.transform = CGAffineTransform(translationX: 0, y: CGFloat($0.direction.rawValue) * percentage * (height + safeArea))
switch $0.direction {
case .scrollDown:
$0.view?.transform = CGAffineTransform(translationX: 0, y: percentage * (height + safeArea))
case .scrollUp:
$0.view?.transform = CGAffineTransform(translationX: 0, y: -(statusBarHeight - navigationBar.frame.origin.y))
}

return
}
tabBar.isTranslucent = true
Expand Down

0 comments on commit b7a6b31

Please sign in to comment.