Skip to content

Commit f405091

Browse files
2 parents c8b4238 + 7982eea commit f405091

1 file changed

Lines changed: 14 additions & 9 deletions

File tree

WYPopoverController/WYPopoverController.m

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ - (void)setViewController:(UIViewController *)viewController
763763
{
764764
contentView = viewController.view;
765765

766-
contentView.frame = CGRectMake(0, 0, self.bounds.size.width, 100);
766+
contentView.frame = CGRectIntegral(CGRectMake(0, 0, self.bounds.size.width, 100));
767767

768768
[self addSubview:contentView];
769769

@@ -775,7 +775,7 @@ - (void)setViewController:(UIViewController *)viewController
775775
navigationBarHeight = navigationController.navigationBar.bounds.size.height;
776776
}
777777

778-
contentView.frame = [self innerRect];
778+
contentView.frame = CGRectIntegral([self innerRect]);
779779

780780
if (innerView == nil)
781781
{
@@ -801,7 +801,7 @@ - (void)setViewController:(UIViewController *)viewController
801801

802802
[self insertSubview:innerView aboveSubview:contentView];
803803

804-
innerView.frame = contentView.frame;
804+
innerView.frame = CGRectIntegral(contentView.frame);
805805

806806
[self.layer setNeedsDisplay];
807807
}
@@ -1403,7 +1403,12 @@ - (UIView *)rootView
14031403

14041404
if (result.subviews.count > 0)
14051405
{
1406-
result = [result.subviews lastObject];
1406+
for (UIView *view in result.subviews) {
1407+
if(!view.isHidden){
1408+
return view;
1409+
}
1410+
}
1411+
// result = [result.subviews lastObject];
14071412
}
14081413

14091414
return result;
@@ -1695,7 +1700,7 @@ - (void)positionPopover
16951700
containerFrame.size.width = MIN(maxX - minX, containerFrame.size.width);
16961701
containerFrame.size.height = MIN(maxY - minY, containerFrame.size.height);
16971702

1698-
containerView.frame = containerFrame;
1703+
containerView.frame = CGRectIntegral(containerFrame);
16991704

17001705
containerView.center = CGPointMake(viewFrame.origin.x + viewFrame.size.width / 2, viewFrame.origin.y + viewFrame.size.height / 2);
17011706

@@ -1794,7 +1799,7 @@ - (void)positionPopover
17941799
containerFrame.size.width = MIN(maxX - minX, containerFrame.size.width);
17951800
containerFrame.size.height = MIN(maxY - minY, containerFrame.size.height);
17961801

1797-
containerView.frame = containerFrame;
1802+
containerView.frame = CGRectIntegral(containerFrame);
17981803

17991804
containerView.center = CGPointMake(viewFrame.origin.x + viewFrame.size.width / 2, viewFrame.origin.y + viewFrame.size.height / 2);
18001805

@@ -1849,7 +1854,7 @@ - (void)positionPopover
18491854

18501855
containerView.center = CGPointMake(viewFrame.origin.x + viewFrame.size.width / 2, viewFrame.origin.y + viewFrame.size.height / 2);
18511856

1852-
containerFrame = containerView.frame;
1857+
containerFrame = CGRectIntegral(containerView.frame);
18531858

18541859
offset = containerView.frame.size.width / 2 + viewFrame.size.width / 2 - containerView.outerShadowInsets.left;
18551860

@@ -1893,7 +1898,7 @@ - (void)positionPopover
18931898
containerFrame.size = containerViewSize;
18941899
containerFrame.size.width = MIN(maxX - minX, containerFrame.size.width);
18951900
containerFrame.size.height = MIN(maxY - minY, containerFrame.size.height);
1896-
containerView.frame = containerFrame;
1901+
containerView.frame = CGRectIntegral(containerFrame);
18971902

18981903
containerView.center = CGPointMake(minX + (maxX - minX) / 2, minY + (maxY - minY) / 2);
18991904

@@ -1902,7 +1907,7 @@ - (void)positionPopover
19021907
containerView.arrowOffset = offset;
19031908
}
19041909

1905-
containerView.frame = containerFrame;
1910+
containerView.frame = CGRectIntegral(containerFrame);
19061911

19071912
containerView.wantsDefaultContentAppearance = wantsDefaultContentAppearance;
19081913

0 commit comments

Comments
 (0)