Skip to content
This repository has been archived by the owner on Aug 7, 2019. It is now read-only.

Commit

Permalink
Add prefix to sizeThatFitsBlock
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexsander Akers committed Jun 1, 2015
1 parent 98db3d4 commit d039db9
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 706 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion FlexboxKit/FLEXBOXNode.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

const CGFloat FLEXBOXUndefinedDimension = CSS_UNDEFINED;

static BOOL FLEXBOX_alwaysDirty(void *context)
static bool FLEXBOX_alwaysDirty(void *context)
{
return YES;
}
Expand Down
2 changes: 1 addition & 1 deletion FlexboxKit/UIView+FLEXBOX.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,6 @@

/// Define this block if you want to specify some custom logic instead of
/// calling -[UIView sizeThatFits:] in -[UIView flexComputeSize:]
@property (nonatomic, copy) CGSize (^sizeThatFitsBlock)(CGSize size);
@property (nonatomic, copy) CGSize (^flexSizeThatFitsBlock)(CGSize size);

@end
10 changes: 5 additions & 5 deletions FlexboxKit/UIView+FLEXBOX.m
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@ - (void)setFlexFixedSize:(CGSize)flexFixedSize
return objc_setAssociatedObject(self, &FLEXBOXSizeKey, [NSValue valueWithCGSize:flexFixedSize], OBJC_ASSOCIATION_RETAIN);
}

- (void)setSizeThatFitsBlock:(CGSize (^)(CGSize))sizeThatFitsBlock
- (void)setFlexSizeThatFitsBlock:(CGSize (^)(CGSize))sizeThatFitsBlock
{
objc_setAssociatedObject(self, &FLEXBOXSizeThatFitsBlock, [sizeThatFitsBlock copy], OBJC_ASSOCIATION_COPY);
}

- (CGSize (^)(CGSize))sizeThatFitsBlock
- (CGSize (^)(CGSize))flexSizeThatFitsBlock
{
return objc_getAssociatedObject(self, &FLEXBOXSizeThatFitsBlock);
}
Expand All @@ -105,9 +105,9 @@ - (CGSize)flexComputeSize:(CGSize)bounds
bounds.width = isnan(bounds.width) ? FLT_MAX : bounds.width;

CGSize size = CGSizeZero;
if (self.sizeThatFitsBlock != nil) {
size = self.sizeThatFitsBlock(bounds);

if (self.flexSizeThatFitsBlock != nil) {
size = self.flexSizeThatFitsBlock(bounds);
} else {
size = [self sizeThatFits:bounds];
}
Expand Down
Loading

0 comments on commit d039db9

Please sign in to comment.