Fixed: setContentSize doesn't work when called several times

Previously when calling setContentSize several times, the final frame of the view was wrong.
I removed the animation as well. This doesn't work, and need a lot more of implementation.
This commit is contained in:
Alexandre Wilhelm
2014-04-30 16:23:00 -07:00
parent 4dadf0cb95
commit 9d694a1589
2 changed files with 11 additions and 9 deletions
+1 -2
View File
@@ -150,8 +150,7 @@ var CPPopoverDelegate_popover_willShow_ = 1 << 0,
*/
- (void)setContentSize:(CGSize)aSize
{
[[_contentViewController view] setFrameSize:aSize];
[_popoverWindow updateFrame];
[_popoverWindow updateFrameWithSize:aSize];
}
/*!
+10 -7
View File
@@ -170,7 +170,9 @@ var _CPPopoverWindow_shouldClose_ = 1 << 4,
if (![_targetView window])
return;
[self updateFrame];
var point = [self computeOriginFromRect:[_targetView bounds] ofView:_targetView preferredEdge:[_windowView preferredEdge]];
[self setFrameOrigin:point];
}
}
@@ -367,17 +369,18 @@ var _CPPopoverWindow_shouldClose_ = 1 << 4,
/*!
@ignore
*/
- (void)updateFrame
- (void)updateFrameWithSize:(CGSize)aSize
{
var rect = CGRectMakeCopy([self frameRectForContentRect:[[self contentView] frame]]),
point = [self computeOriginFromRect:[_targetView bounds] ofView:_targetView preferredEdge:[_windowView preferredEdge]];
var rect = CGRectMakeZero();
rect.size = aSize;
rect.origin = [[self contentView] frameOrigin];
rect.origin = point;
[self setFrame:[self frameRectForContentRect:rect]];
[self setFrame:rect display:YES animate:_animates];
var point = [self computeOriginFromRect:[_targetView bounds] ofView:_targetView preferredEdge:[_windowView preferredEdge]];
[self setFrameOrigin:point];
}
#pragma mark -
#pragma mark Actions