Skip to content

Commit 48be291

Browse files
authored
Merge pull request Boris-Em#31 from Remyoman/master
Added IntrinsicContentSize.
2 parents 0c58541 + 351f4c2 commit 48be291

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,4 @@ ehthumbs.db
88
Thumbs.db
99
xcuserdata/
1010
*.xcuserstate
11-
12-
*.xcuserstate
11+
.idea

Classes/BEMCheckBox.m

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,15 @@ - (void)initAnimationManager {
9494
}
9595

9696
- (void)layoutSubviews {
97-
self.pathManager.size = self.frame.size.height;
97+
self.pathManager.size = CGRectGetHeight(self.frame);
9898

9999
[super layoutSubviews];
100100
}
101101

102+
- (CGSize)intrinsicContentSize {
103+
return self.frame.size;
104+
}
105+
102106
- (void)reload {
103107
[self.offBoxLayer removeFromSuperlayer];
104108
self.offBoxLayer = nil;
@@ -208,8 +212,8 @@ - (BOOL) pointInside:(CGPoint)point withEvent:(UIEvent *)event;
208212
BOOL found = [super pointInside:point withEvent:event];
209213

210214
CGSize minimumSize = self.minimumTouchSize;
211-
CGFloat width = self.bounds.size.width;
212-
CGFloat height = self.bounds.size.height;
215+
CGFloat width = CGRectGetWidth(self.bounds);
216+
CGFloat height = CGRectGetHeight(self.bounds);
213217

214218
if (found == NO && (width < minimumSize.width || height < minimumSize.height)) {
215219
CGFloat increaseWidth = minimumSize.width - width;
@@ -232,7 +236,7 @@ - (void)drawRect:(CGRect)rect {
232236
*/
233237
- (void)drawEntireCheckBox {
234238
if (!self.hideBox) {
235-
if (!self.offBoxLayer || CGPathGetBoundingBox(self.offBoxLayer.path).size.height == 0.0) {
239+
if (!self.offBoxLayer || CGRectGetHeight(CGPathGetBoundingBox(self.offBoxLayer.path)) == 0.0) {
236240
[self drawOffBox];
237241
}
238242
if (self.on) {

0 commit comments

Comments
 (0)