Skip to content
Browse files

Merge pull request #8 from stefanceriu/master

Automatically setting the initialFrame
  • Loading branch information...
2 parents efbf8d6 + 7ccb635 commit 993a1798b4e4e4d79d37a6dee2180d525f386526 @steipete committed Jun 17, 2012
Showing with 10 additions and 2 deletions.
  1. +2 −1 Example/PSPushPopPressViewExample/PSExampleViewController.m
  2. +8 −1 PSPushPopPressView.m
View
3 Example/PSPushPopPressViewExample/PSExampleViewController.m
@@ -36,7 +36,8 @@ - (void)viewDidLoad {
// create the push pop press container
CGRect firstRect = ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) ? CGRectMake(140, 40, 500, 400) : CGRectMake(10, 10, 300, 300);
- pushPopPressView_ = [[PSPushPopPressView alloc] initWithFrame:firstRect];
+ pushPopPressView_ = [[PSPushPopPressView alloc] init];
+ pushPopPressView_.frame = firstRect;
pushPopPressView_.pushPopPressViewDelegate = self;
[containerView_ addSubview:pushPopPressView_];
View
9 PSPushPopPressView.m
@@ -51,7 +51,6 @@ - (id)initWithFrame:(CGRect)frame_ {
scaleTransform_ = CGAffineTransformIdentity;
rotateTransform_ = CGAffineTransformIdentity;
panTransform_ = CGAffineTransformIdentity;
- initialFrame_ = frame_;
initialIndex_ = 0;
allowSingleTapSwitch_ = YES;
keepShadow_ = NO;
@@ -117,6 +116,14 @@ - (void)dealloc {
pushPopPressViewDelegate = nil;
}
+- (void) setFrame:(CGRect)frame
+{
+ [super setFrame:frame];
+
+ if(![self.superview isEqual:[self rootView]])
+ initialFrame_ = self.frame;
+}
+
- (void)setInitialFrame:(CGRect)initialFrame {
initialFrame_ = initialFrame;

0 comments on commit 993a179

Please sign in to comment.
Something went wrong with that request. Please try again.