Visitar URL original
implement ORStackViewController · orta/ORStackView@4215254 · GitHub
Skip to content

Commit 4215254

Browse files
committed
implement ORStackViewController
1 parent ebba5be commit 4215254

4 files changed

Lines changed: 47 additions & 18 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//
2+
// ORStackViewController.h
3+
// Pods
4+
//
5+
// Created by Dzianis Lebedzeu on 5/5/15.
6+
//
7+
//
8+
9+
#import "ORStackScrollView.h"
10+
11+
@interface ORStackViewController : UIViewController
12+
13+
@property (nonatomic, readonly) ORStackScrollView *scrollView;
14+
@property (nonatomic, readonly) ORStackView *stackView;
15+
16+
@end
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//
2+
// ORStackViewController.m
3+
// Pods
4+
//
5+
// Created by Dzianis Lebedzeu on 5/5/15.
6+
//
7+
//
8+
9+
#import "ORStackViewController.h"
10+
11+
@implementation ORStackViewController
12+
13+
- (void)loadView {
14+
self.view = [[ORStackScrollView alloc] init];
15+
}
16+
17+
- (ORStackScrollView *)scrollView {
18+
return (ORStackScrollView *)self.view;
19+
}
20+
21+
- (ORStackView *)stackView {
22+
return self.scrollView.stackView;
23+
}
24+
25+
@end

‎ORStackViewExample/ORSecondViewController.h‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
// Copyright (c) 2013 Orta. All rights reserved.
77
//
88

9-
@interface ORSecondViewController : UIViewController
9+
#import <ORStackView/ORStackViewController.h>
10+
11+
@interface ORSecondViewController : ORStackViewController
1012

1113
@end

‎ORStackViewExample/ORSecondViewController.m‎

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,31 +12,16 @@
1212

1313
// More complex use case: Inserting
1414

15-
@interface ORSecondViewController ()
16-
@property (nonatomic, strong) ORStackView *stackView;
17-
@end
18-
1915
@implementation ORSecondViewController
2016

2117
- (UIStatusBarStyle)preferredStatusBarStyle {
2218
return UIStatusBarStyleLightContent;
2319
}
2420

25-
- (void)loadView
26-
{
27-
self.view = [[UIView alloc] init];
28-
}
29-
3021
- (void)viewDidLoad
3122
{
32-
self.stackView = [[ORStackView alloc] init];
33-
[self.view addSubview:self.stackView];
34-
if ([self respondsToSelector:@selector(topLayoutGuide)]) {
35-
[self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.stackView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.topLayoutGuide attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0]];
36-
}
37-
[self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.stackView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeWidth multiplier:1.0 constant:0]];
38-
[self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.stackView attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeCenterX multiplier:1.0 constant:0]];
39-
23+
self.edgesForExtendedLayout = UIRectEdgeNone;
24+
4025
ORColourView *view1 = [[ORColourView alloc] init];
4126
view1.text = @"1 - ORStackView - Tap Me";
4227
view1.fakeContentSize = (CGSize){ UIViewNoIntrinsicMetric , 40};
@@ -76,4 +61,5 @@ - (void)removeTappedView:(UITapGestureRecognizer *)gesture
7661
{
7762
[self.stackView removeSubview:gesture.view];
7863
}
64+
7965
@end

0 commit comments

Comments
 (0)