Skip to content

Commit

Permalink
[Update] project's layout
Browse files Browse the repository at this point in the history
  • Loading branch information
baltamimi committed Feb 25, 2016
1 parent bfcc9cf commit 9db16ef
Show file tree
Hide file tree
Showing 15 changed files with 483 additions and 29 deletions.
33 changes: 33 additions & 0 deletions TestStackView.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
C3297AE21C7C5D8E001E694F /* DPSSStackViewProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = C3297AE11C7C5D8E001E694F /* DPSSStackViewProxy.m */; };
C3297AE31C7C5D8E001E694F /* DPSSStackViewProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = C3297AE11C7C5D8E001E694F /* DPSSStackViewProxy.m */; };
C3297AE41C7C5D8E001E694F /* DPSSStackViewProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = C3297AE11C7C5D8E001E694F /* DPSSStackViewProxy.m */; };
C32CC8D81C7F7C650092E55B /* DPSSDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C32CC8D71C7F7C650092E55B /* DPSSDelegate.m */; };
C32CC8D91C7F7C650092E55B /* DPSSDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C32CC8D71C7F7C650092E55B /* DPSSDelegate.m */; };
C32CC8DA1C7F7C650092E55B /* DPSSDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C32CC8D71C7F7C650092E55B /* DPSSDelegate.m */; };
C32CC8DD1C7F87870092E55B /* DPTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = C32CC8DC1C7F87870092E55B /* DPTableView.m */; };
C32CC8DE1C7F87870092E55B /* DPTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = C32CC8DC1C7F87870092E55B /* DPTableView.m */; };
C32CC8DF1C7F87870092E55B /* DPTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = C32CC8DC1C7F87870092E55B /* DPTableView.m */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -71,6 +77,10 @@
C3297AD61C7C47EE001E694F /* DPSSStackView+UILayout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "DPSSStackView+UILayout.m"; sourceTree = "<group>"; };
C3297AE01C7C5D8E001E694F /* DPSSStackViewProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DPSSStackViewProxy.h; sourceTree = "<group>"; };
C3297AE11C7C5D8E001E694F /* DPSSStackViewProxy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DPSSStackViewProxy.m; sourceTree = "<group>"; };
C32CC8D61C7F7C650092E55B /* DPSSDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DPSSDelegate.h; sourceTree = "<group>"; };
C32CC8D71C7F7C650092E55B /* DPSSDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DPSSDelegate.m; sourceTree = "<group>"; };
C32CC8DB1C7F87870092E55B /* DPTableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DPTableView.h; sourceTree = "<group>"; };
C32CC8DC1C7F87870092E55B /* DPTableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DPTableView.m; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -121,12 +131,15 @@
C3297A951C7C1685001E694F /* TestStackView */ = {
isa = PBXGroup;
children = (
C32CC8D51C7F7C300092E55B /* DPSSDelegates */,
C3297ACE1C7C16E8001E694F /* DPSSStackView */,
C3297AC91C7C16A4001E694F /* DPTabViewController */,
C3297A991C7C1685001E694F /* AppDelegate.h */,
C3297A9A1C7C1685001E694F /* AppDelegate.m */,
C3297A9C1C7C1685001E694F /* ViewController.h */,
C3297A9D1C7C1685001E694F /* ViewController.m */,
C32CC8DB1C7F87870092E55B /* DPTableView.h */,
C32CC8DC1C7F87870092E55B /* DPTableView.m */,
C3297A9F1C7C1685001E694F /* Main.storyboard */,
C3297AA21C7C1685001E694F /* Assets.xcassets */,
C3297AA41C7C1685001E694F /* LaunchScreen.storyboard */,
Expand Down Expand Up @@ -194,6 +207,15 @@
name = DPSSStackViewHelpers;
sourceTree = "<group>";
};
C32CC8D51C7F7C300092E55B /* DPSSDelegates */ = {
isa = PBXGroup;
children = (
C32CC8D61C7F7C650092E55B /* DPSSDelegate.h */,
C32CC8D71C7F7C650092E55B /* DPSSDelegate.m */,
);
name = DPSSDelegates;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -328,8 +350,10 @@
C3297ACD1C7C16A4001E694F /* DPTabView.m in Sources */,
C3297A9E1C7C1685001E694F /* ViewController.m in Sources */,
C3297AD71C7C47EE001E694F /* DPSSStackView+UILayout.m in Sources */,
C32CC8DD1C7F87870092E55B /* DPTableView.m in Sources */,
C3297A9B1C7C1685001E694F /* AppDelegate.m in Sources */,
C3297A981C7C1685001E694F /* main.m in Sources */,
C32CC8D81C7F7C650092E55B /* DPSSDelegate.m in Sources */,
C3297AE21C7C5D8E001E694F /* DPSSStackViewProxy.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -339,9 +363,11 @@
buildActionMask = 2147483647;
files = (
C3297AE31C7C5D8E001E694F /* DPSSStackViewProxy.m in Sources */,
C32CC8DE1C7F87870092E55B /* DPTableView.m in Sources */,
C3297AD81C7C47EE001E694F /* DPSSStackView+UILayout.m in Sources */,
C3297AB11C7C1685001E694F /* TestStackViewTests.m in Sources */,
C3297AD21C7C1702001E694F /* DPSSStackView.m in Sources */,
C32CC8D91C7F7C650092E55B /* DPSSDelegate.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -350,9 +376,11 @@
buildActionMask = 2147483647;
files = (
C3297AE41C7C5D8E001E694F /* DPSSStackViewProxy.m in Sources */,
C32CC8DF1C7F87870092E55B /* DPTableView.m in Sources */,
C3297AD91C7C47EE001E694F /* DPSSStackView+UILayout.m in Sources */,
C3297ABC1C7C1685001E694F /* TestStackViewUITests.m in Sources */,
C3297AD31C7C1702001E694F /* DPSSStackView.m in Sources */,
C32CC8DA1C7F7C650092E55B /* DPSSDelegate.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -479,6 +507,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
INFOPLIST_FILE = TestStackView/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
OTHER_LDFLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = com.intigral.TestStackView;
PRODUCT_NAME = "$(TARGET_NAME)";
};
Expand All @@ -490,6 +519,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
INFOPLIST_FILE = TestStackView/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
OTHER_LDFLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = com.intigral.TestStackView;
PRODUCT_NAME = "$(TARGET_NAME)";
};
Expand Down Expand Up @@ -562,6 +592,7 @@
C3297AC21C7C1685001E694F /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
C3297AC31C7C1685001E694F /* Build configuration list for PBXNativeTarget "TestStackViewTests" */ = {
isa = XCConfigurationList;
Expand All @@ -570,6 +601,7 @@
C3297AC51C7C1685001E694F /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
C3297AC61C7C1685001E694F /* Build configuration list for PBXNativeTarget "TestStackViewUITests" */ = {
isa = XCConfigurationList;
Expand All @@ -578,6 +610,7 @@
C3297AC81C7C1685001E694F /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
type = "1"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "TestStackView/DPSSStackView/DPSSStackView.m"
timestampString = "478126437.454767"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "169"
endingLineNumber = "169"
landmarkName = "-headerContainer"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "TestStackView/DPSSStackView/DPSSStackView.m"
timestampString = "478126489.930892"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "115"
endingLineNumber = "115"
landmarkName = "-layoutSubviews"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
22 changes: 21 additions & 1 deletion TestStackView/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9530"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<!--Data Source-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" sceneMemberID="viewController">
Expand All @@ -16,8 +17,27 @@
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Dee-b1-B7R" customClass="DPSSStackView">
<rect key="frame" x="20" y="0.0" width="560" height="600"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<connections>
<outlet property="dataSource" destination="BYZ-38-t0r" id="Vpi-br-5Mn"/>
<outlet property="delegate" destination="BYZ-38-t0r" id="IJV-0M-eEe"/>
</connections>
</view>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="Dee-b1-B7R" firstAttribute="top" secondItem="8bC-Xf-vdC" secondAttribute="topMargin" id="0Ap-mI-uVT"/>
<constraint firstAttribute="trailingMargin" secondItem="Dee-b1-B7R" secondAttribute="trailing" id="S8M-wS-7vJ"/>
<constraint firstItem="wfy-db-euE" firstAttribute="top" secondItem="Dee-b1-B7R" secondAttribute="bottom" id="fku-6I-aqW"/>
<constraint firstItem="Dee-b1-B7R" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leadingMargin" id="fwb-JU-w4a"/>
</constraints>
</view>
<connections>
<outlet property="stackView" destination="Dee-b1-B7R" id="AGh-UO-ofH"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
Expand Down
30 changes: 30 additions & 0 deletions TestStackView/DPSSDelegate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//
// DPSSDelegate.h
// TestStackView
//
// Created by Basil Al-Tamimi on 2/25/16.
// Copyright © 2016 Basil Al-Tamimi. All rights reserved.
//

#import <Foundation/Foundation.h>

#import "DPTabView.h"

typedef enum : NSUInteger {
DPSSDelegateTypeIPhone,
DPSSDelegateTypeIPad
} DPSSDelegateType;

@interface DPSSDelegate : NSObject<DPTabViewDataSource,DPTabViewDelegate>

+ (instancetype)ssDelegateWithType:(DPSSDelegateType)type;

@end

@interface DPSSDelegateIPhone : DPSSDelegate

@end

@interface DPSSDelegateIPad : DPSSDelegate

@end
102 changes: 102 additions & 0 deletions TestStackView/DPSSDelegate.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
//
// DPSSDelegate.m
// TestStackView
//
// Created by Basil Al-Tamimi on 2/25/16.
// Copyright © 2016 Basil Al-Tamimi. All rights reserved.
//

#import "DPSSDelegate.h"

#define kMainColor [UIColor colorWithRed:190/255. green:10/255. blue:30/255. alpha:1]
#define kSupportColor [UIColor colorWithRed:209/255. green:29/255. blue:51/255. alpha:1]

@implementation DPSSDelegate

+ (instancetype)ssDelegateWithType:(DPSSDelegateType)type {

if (type == DPSSDelegateTypeIPhone) {
return [DPSSDelegateIPhone new];
} else {
return [DPSSDelegateIPad new];
}
}

- (CGFloat)tabViewTabBarHorizontalMargin:(DPTabView *)tabView {return 0;}

- (CGFloat)tabViewTabBarHeight:(DPTabView *)tabView {
NSAssert(false, @"tabViewNumberOfTabs needs to be implemented in the subclass");
return 0;
}

- (UIView *)tabViewSelectionCursor:(DPTabView *)tabView {
return [UIView new];
}

@end

@implementation DPSSDelegateIPhone

- (NSInteger)tabViewNumberOfTabs:(DPTabView *)tabView {
return 2;
}

- (CGFloat)tabViewTabBarHorizontalMargin:(DPTabView *)tabView {
return 10;
}

- (CGFloat)tabViewTabBarHeight:(DPTabView *)tabView {
return 40;
}

- (void)tabView:(DPTabView *)tabView configurateButton:(UIButton *)button forIndex:(NSInteger)index withState:(DPTabViewButtonState)state {
static CALayer *upperBorder;
if (!upperBorder) {
upperBorder = [CALayer layer];
upperBorder.backgroundColor = [kSupportColor CGColor];
}

switch (state) {
case DPTabViewButtonState_init: {
button.layer.cornerRadius = 2;
button.titleLabel.font = [UIFont systemFontOfSize:14];
button.clipsToBounds = YES;
break;
}

case DPTabViewButtonState_selected: {
button.backgroundColor = kMainColor;
upperBorder.frame = CGRectMake(0, 0, CGRectGetWidth(button.frame), 1.0f);
[button.layer addSublayer:upperBorder];
break;
}

case DPTabViewButtonState_deselected: {
button.backgroundColor = [UIColor clearColor];
break;
}
}
}

- (UIView *)tabViewSelectionCursor:(DPTabView *)tabView {
CGFloat lineHeight = 3;
CGFloat horMargin = [tabView tabBarHorizontalMargin];
CGFloat cursorWidth = tabView.frame.size.width - (horMargin * 2);

UIView *cursor = [[UIView alloc] initWithFrame:(CGRect){horMargin,[tabView tabBarHeight] - lineHeight, cursorWidth, lineHeight}];
cursor.backgroundColor = kMainColor;

CALayer *upperBorder = [CALayer layer];
upperBorder.backgroundColor = [kSupportColor CGColor];
upperBorder.frame = CGRectMake(0, 0, cursorWidth, 1.0f);
[cursor.layer addSublayer:upperBorder];

return cursor;
}


@end

@implementation DPSSDelegateIPad

@end
10 changes: 10 additions & 0 deletions TestStackView/DPSSStackView/DPSSStackView+UILayout.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@

@interface DPSSStackView (UILayout)

@property (nonatomic, weak) UIScrollView *currScrollView;
@property (nonatomic, weak) UIView *headerContainerView;
@property (nonatomic, weak) UIView *childeContainerView;

@property (nonatomic) CGFloat previousYOffset;
@property (nonatomic) CGFloat resistanceConsumed;

@property (nonatomic) NSNumber *expansionResistance; // default 200
@property (nonatomic) CGFloat contractionResistance; // default 0

- (CGFloat)width;
- (CGFloat)height;
- (CGFloat)frameWidth:(CGRect)frame;
Expand Down
Loading

0 comments on commit 9db16ef

Please sign in to comment.