Skip to content

Commit

Permalink
Modify example.
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxime Epain committed Mar 22, 2015
1 parent 8ac00b7 commit 8ad1c39
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 48 deletions.
36 changes: 17 additions & 19 deletions Example/MXSegmentedPager/Base.lproj/Main_iPhone.storyboard
Original file line number Diff line number Diff line change
@@ -1,46 +1,44 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6751" systemVersion="14C1510" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="o9c-rq-WX6">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6751" systemVersion="14C1510" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="eDJ-9o-8JA">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6736"/>
</dependencies>
<scenes>
<!--Root View Controller-->
<scene sceneID="xN4-dL-yXS">
<!--MXSegmentedPager-->
<scene sceneID="c6S-qu-64f">
<objects>
<tableViewController id="FJE-cX-rWX" customClass="MXMenuViewController" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="pjH-Pf-vM2">
<rect key="frame" x="0.0" y="64" width="320" height="568"/>
<tableViewController id="HbT-Vv-rK7" customClass="MXMenuViewController" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="dYQ-CF-Lof">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<connections>
<outlet property="dataSource" destination="FJE-cX-rWX" id="UcH-bB-ebM"/>
<outlet property="delegate" destination="FJE-cX-rWX" id="rBY-8j-Yak"/>
<outlet property="dataSource" destination="HbT-Vv-rK7" id="8E1-d1-ORE"/>
<outlet property="delegate" destination="HbT-Vv-rK7" id="CJN-ad-q1o"/>
</connections>
</tableView>
<navigationItem key="navigationItem" title="Root View Controller" id="6fg-kX-tp3"/>
<navigationItem key="navigationItem" title="MXSegmentedPager" id="ReK-Cs-xLW"/>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="htH-hM-tiz" userLabel="First Responder" sceneMemberID="firstResponder"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="1CN-I1-5KB" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1156" y="261"/>
<point key="canvasLocation" x="848" y="642"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="J4n-66-rW8">
<scene sceneID="3zV-0y-auB">
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="o9c-rq-WX6" sceneMemberID="viewController">
<navigationBar key="navigationBar" opaque="NO" contentMode="scaleToFill" id="l1S-Xk-xhx">
<navigationController id="eDJ-9o-8JA" sceneMemberID="viewController">
<navigationBar key="navigationBar" contentMode="scaleToFill" id="MXn-X4-8kR">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<color key="tintColor" cocoaTouchSystemColor="darkTextColor"/>
</navigationBar>
<connections>
<segue destination="FJE-cX-rWX" kind="relationship" relationship="rootViewController" id="Rb0-mr-dtc"/>
<segue destination="HbT-Vv-rK7" kind="relationship" relationship="rootViewController" id="paF-Kv-sBG"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="6D0-pX-rGd" userLabel="First Responder" sceneMemberID="firstResponder"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="HS2-kZ-qI0" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="616" y="261"/>
<point key="canvasLocation" x="308" y="642"/>
</scene>
</scenes>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
Expand Down
8 changes: 8 additions & 0 deletions Example/MXSegmentedPager/MXMenuViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ @interface MXMenuViewController ()

@implementation MXMenuViewController

- (void)viewDidLoad {
[super viewDidLoad];

[self.navigationController.navigationBar setBackgroundImage:[UIImage new]
forBarMetrics:UIBarMetricsDefault];
self.navigationController.navigationBar.shadowImage = [UIImage new];
}

#pragma -mark <UITableViewDelegate>

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
Expand Down
4 changes: 1 addition & 3 deletions Example/MXSegmentedPager/MXParallaxViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ - (void)viewDidLoad
{
[super viewDidLoad];

[self.navigationController.navigationBar setBackgroundImage:[UIImage new]
forBarMetrics:UIBarMetricsDefault];
self.navigationController.navigationBar.shadowImage = [UIImage new];
self.navigationController.navigationBar.translucent = YES;
self.automaticallyAdjustsScrollViewInsets = NO;

// Setup the segmented pager properties
Expand Down
34 changes: 8 additions & 26 deletions Example/MXSegmentedPager/MXSimpleViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#import "MXSegmentedPager.h"

@interface MXSimpleViewController () <MXSegmentedPagerDelegate, MXSegmentedPagerDataSource, UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong) UIImageView * cover;
@property (nonatomic, strong) MXSegmentedPager * segmentedPager;
@property (nonatomic, strong) UITableView * tableView;
@property (nonatomic, strong) UIWebView * webView;
Expand All @@ -37,7 +36,7 @@ - (void)viewDidLoad
{
[super viewDidLoad];

[self.view addSubview:self.cover];
self.navigationController.navigationBar.translucent = NO;

// Setup the segmented pager properties
self.segmentedPager.delegate = self;
Expand All @@ -46,36 +45,16 @@ - (void)viewDidLoad
[self.view addSubview:self.segmentedPager];
}

#pragma -mark private methods

- (UIImageView *)cover {
if (!_cover) {
// Boundary between cover and segmented pager
CGFloat boundary = self.view.frame.size.height / 3;

// Set a cover on the top of the view
_cover = [[UIImageView alloc] initWithFrame:(CGRect){
.origin = CGPointZero,
.size.width = self.view.frame.size.width,
.size.height = boundary
}];
_cover.contentMode = UIViewContentModeScaleAspectFill;
_cover.image = [UIImage imageNamed:@"success-baby"];
}
return _cover;
}
#pragma -mark Properties

- (MXSegmentedPager *)segmentedPager {
if (!_segmentedPager) {
// Boundary between cover and segmented pager
CGFloat boundary = self.view.frame.size.height / 3;

// Set a segmented pager below the cover
// Set a segmented pager
_segmentedPager = [[MXSegmentedPager alloc] initWithFrame:(CGRect){
.origin.x = 0,
.origin.y = boundary,
.origin = CGPointZero,
.size.width = self.view.frame.size.width,
.size.height = 2 * boundary
.size.height = self.view.frame.size.height - 64.f
}];
}
return _segmentedPager;
Expand Down Expand Up @@ -123,6 +102,7 @@ - (UITextView *)textView {
}

#pragma -mark <MXSegmentedPagerDataSource>

- (NSInteger)numberOfPagesInSegmentedPager:(MXSegmentedPager *)segmentedPager {
return 3;
}
Expand All @@ -136,6 +116,7 @@ - (UIView *)segmentedPager:(MXSegmentedPager *)segmentedPager viewForPageAtIndex
}

#pragma -mark <UITableViewDelegate>

- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 50;
}
Expand All @@ -146,6 +127,7 @@ - (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPat
}

#pragma -mark <UITableViewDataSource>

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";

Expand Down
Binary file added Example/ParallaxView.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Example/SimpleView.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8ad1c39

Please sign in to comment.