Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TranslationChangeController.h 中的tableView 当有多个section的时候,tableview上方有空白 #20

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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: 4 additions & 0 deletions LTNavigationBar/BGColorDemoViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPa
return 65;
}

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
return @"header";
}

- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
Expand Down
36 changes: 28 additions & 8 deletions LTNavigationBar/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6254" systemVersion="14A388b" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="r1i-pR-mnD">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9059" systemVersion="15B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="r1i-pR-mnD">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6247"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9049"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
</dependencies>
<scenes>
Expand All @@ -19,29 +20,38 @@
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" misplaced="YES" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" translatesAutoresizingMaskIntoConstraints="NO" id="ol6-pv-3ev">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<imageView key="tableHeaderView" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="bg.jpg" id="982-4M-Fxk">
<rect key="frame" x="0.0" y="0.0" width="320" height="223"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
</imageView>
<prototypes>
<tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="Cell" textLabel="T8Y-og-A43" style="IBUITableViewCellStyleDefault" id="bN5-oq-e1N">
<rect key="frame" x="0.0" y="245" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="bN5-oq-e1N" id="wxY-p8-Xkx">
<rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="T8Y-og-A43">
<rect key="frame" x="15" y="0.0" width="290" height="43"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<animations/>
</tableViewCellContentView>
<animations/>
</tableViewCell>
</prototypes>
</tableView>
</subviews>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="trailingMargin" secondItem="ol6-pv-3ev" secondAttribute="trailing" constant="-16" id="3SJ-yy-OpP"/>
Expand Down Expand Up @@ -80,6 +90,7 @@
<view key="view" contentMode="scaleToFill" id="5Or-1G-CWm">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
<navigationItem key="navigationItem" id="OdV-jx-pH7"/>
Expand All @@ -97,6 +108,7 @@
<navigationBar key="navigationBar" contentMode="scaleToFill" id="Gkr-Qb-Foq">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<animations/>
</navigationBar>
<nil name="viewControllers"/>
<connections>
Expand All @@ -121,29 +133,38 @@
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" translatesAutoresizingMaskIntoConstraints="NO" id="Ywl-LE-mp3">
<rect key="frame" x="0.0" y="0.0" width="320" height="519"/>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<imageView key="tableHeaderView" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="bg.jpg" id="eNZ-sc-ljC">
<rect key="frame" x="0.0" y="0.0" width="320" height="223"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
</imageView>
<prototypes>
<tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="Cell" textLabel="ECL-Pp-JyS" style="IBUITableViewCellStyleDefault" id="kkz-WZ-qQT">
<rect key="frame" x="0.0" y="245" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="kkz-WZ-qQT" id="YMY-kb-IEm">
<rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="ECL-Pp-JyS">
<rect key="frame" x="15" y="0.0" width="290" height="43"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<animations/>
</tableViewCellContentView>
<animations/>
</tableViewCell>
</prototypes>
</tableView>
</subviews>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="Ywl-LE-mp3" firstAttribute="top" secondItem="xIv-BB-hMn" secondAttribute="bottom" constant="-64" id="Rrz-pS-6Fl"/>
Expand All @@ -153,7 +174,9 @@
</constraints>
</view>
<navigationItem key="navigationItem" title="Title" id="zDd-Se-Qp6">
<barButtonItem key="leftBarButtonItem" title="button" id="34V-cE-8RG"/>
<barButtonItem key="leftBarButtonItem" systemItem="done" id="34V-cE-8RG">
<color key="tintColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</barButtonItem>
<barButtonItem key="rightBarButtonItem" systemItem="add" id="pw2-H6-SSA">
<color key="tintColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</barButtonItem>
Expand All @@ -175,6 +198,7 @@
<navigationBar key="navigationBar" contentMode="scaleToFill" id="hQl-vu-99O">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<animations/>
</navigationBar>
<nil name="viewControllers"/>
<connections>
Expand All @@ -193,6 +217,7 @@
<nil key="simulatedBottomBarMetrics"/>
<tabBar key="tabBar" contentMode="scaleToFill" id="2AJ-NW-CwM">
<autoresizingMask key="autoresizingMask"/>
<animations/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</tabBar>
<connections>
Expand All @@ -208,9 +233,4 @@
<resources>
<image name="bg.jpg" width="1000" height="667"/>
</resources>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4"/>
</simulatedMetricsContainer>
</document>
11 changes: 9 additions & 2 deletions LTNavigationBar/ScrollingNavbarDemoViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,14 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView
if (offsetY > 0) {
if (offsetY >= 44) {
[self setNavigationBarTransformProgress:1];
scrollView.contentInset = UIEdgeInsetsMake(20, 0, 0, 0);
} else {
[self setNavigationBarTransformProgress:(offsetY / 44)];
scrollView.contentInset = UIEdgeInsetsMake(20 + offsetY, 0, 0, 0);
}
} else {
[self setNavigationBarTransformProgress:0];
scrollView.contentInset = UIEdgeInsetsMake(64, 0, 0, 0);
self.navigationController.navigationBar.backIndicatorImage = [UIImage new];
}
}
Expand All @@ -59,12 +62,12 @@ - (void)viewWillDisappear:(BOOL)animated

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 10;
return 6;
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
return 4;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
Expand All @@ -80,5 +83,9 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPa
return 65;
}

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
return @"header";
}

@end
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
![LTNavigationbar](https://cocoapod-badges.herokuapp.com/v/LTNavigationBar/badge.png)

## Fix Bugs
Delete the blanks of multi sections of table view in "TranslationChangeController.h"

## Purpose
It is hard to change the appearance of UINavigationBar dynamically, so I made this lib to make the job easy.

Expand Down