Skip to content

Commit

Permalink
aligning content to navigation bar toggle in IB
Browse files Browse the repository at this point in the history
  • Loading branch information
yoiang committed Nov 3, 2014
1 parent c8487c5 commit e44dc22
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions StoryboardXibController/StoryboardXibController.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
@property (readwrite) IBInspectable NSString *screenNib;
@property (readwrite) IBInspectable NSString *nibBundleName;

@property (readwrite) IBInspectable BOOL alignContentToNavigationBar;

@property (strong, readonly) UIViewController *containedController;

@property (strong, readwrite) void (^containedControllerLoadedHandler)(StoryboardXibController *storyboardXibController);
Expand Down
2 changes: 1 addition & 1 deletion StoryboardXibController/StoryboardXibController.m
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ - (void)setupContainedViewConstraints
- (void)updateContainedViewTopConstraint
{
CGFloat offsetTop = 0;
if ( [self isWithinNavigationController] )
if ( self.alignContentToNavigationBar && [self isWithinNavigationController] )
{
offsetTop = [self navigationBarFrame].origin.y + [self navigationBarFrame].size.height;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6250" systemVersion="14A388a" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="x5t-JY-7W0">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6244"/>
</dependencies>
<scenes>
Expand Down Expand Up @@ -63,6 +64,7 @@
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="screenControllerClass" value="XibViewController"/>
<userDefinedRuntimeAttribute type="string" keyPath="screenNib" value="SecondView"/>
<userDefinedRuntimeAttribute type="boolean" keyPath="alignContentToNavigationBar" value="YES"/>
</userDefinedRuntimeAttributes>
<connections>
<segue destination="KCG-Ai-Gye" kind="push" identifier="Next" id="a40-TV-CRM"/>
Expand All @@ -89,6 +91,7 @@
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="screenControllerClass" value="XibViewController"/>
<userDefinedRuntimeAttribute type="string" keyPath="screenNib" value="ThirdView"/>
<userDefinedRuntimeAttribute type="boolean" keyPath="alignContentToNavigationBar" value="YES"/>
</userDefinedRuntimeAttributes>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="0nP-RK-EHz" userLabel="First Responder" sceneMemberID="firstResponder"/>
Expand Down

1 comment on commit e44dc22

@yoiang
Copy link
Member Author

@yoiang yoiang commented on e44dc22 Nov 3, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Toggle for fix in #2

Please sign in to comment.