Skip to content

Commit

Permalink
Merge pull request #8 from stefanceriu/master
Browse files Browse the repository at this point in the history
Automatically setting the initialFrame
  • Loading branch information
steipete committed Jun 17, 2012
2 parents efbf8d6 + 7ccb635 commit 993a179
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Example/PSPushPopPressViewExample/PSExampleViewController.m
Expand Up @@ -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_];

Expand Down
9 changes: 8 additions & 1 deletion PSPushPopPressView.m
Expand Up @@ -51,7 +51,6 @@ - (id)initWithFrame:(CGRect)frame_ {
scaleTransform_ = CGAffineTransformIdentity;
rotateTransform_ = CGAffineTransformIdentity;
panTransform_ = CGAffineTransformIdentity;
initialFrame_ = frame_;
initialIndex_ = 0;
allowSingleTapSwitch_ = YES;
keepShadow_ = NO;
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 993a179

Please sign in to comment.