-
Notifications
You must be signed in to change notification settings - Fork 83
/
PSScrollContentView.m
60 lines (42 loc) · 1.23 KB
/
PSScrollContentView.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//
// PRPScrollContentView.m
// ScrollViewPins
//
// Created by Matt Drance on 2/22/11.
// Copyright 2011 Bookhouse Software LLC. All rights reserved.
//
#import "PSScrollContentView.h"
@interface PSScrollContentView ()
- (void)adjustSubviewsForTransform:(CGAffineTransform)transform;
@end
@implementation PSScrollContentView
@synthesize nonScalingSubviews = nonScalingSubviews_;
- (void)dealloc {
MCRelease(nonScalingSubviews_);
[super dealloc];
}
#pragma mark -
#pragma mark Accessors
- (NSMutableSet *)nonScalingSubviews {
if (nonScalingSubviews_ == nil) {
nonScalingSubviews_ = [[NSMutableSet alloc] init];
}
return nonScalingSubviews_;
}
- (void)addNonScalingSubview:(UIView *)view {
[self.nonScalingSubviews addObject:view];
[self addSubview:view];
}
#pragma mark -
#pragma mark (Non-)Scaling support
- (void)setTransform:(CGAffineTransform)transform {
[super setTransform:transform];
[self adjustSubviewsForTransform:transform];
}
- (void)adjustSubviewsForTransform:(CGAffineTransform)transform {
CGAffineTransform inversion = CGAffineTransformInvert(transform);
for (UIView *subview in self.nonScalingSubviews) {
subview.transform = inversion;
}
}
@end