Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // fix the wrong value of sizeThatFits in a UITableViewCell for iOS8
- // UITableViewCell+iOS8.h
- #import <UIKit/UIKit.h>
- @interface UITableViewCell (iOS8)
- - (CGSize)sizeThatFitsiOS8:(CGSize)size;
- @end
- // UITableViewCell+iOS8.m
- #import "UITableViewCell+iOS8.h"
- @implementation UITableViewCell (iOS8)
- - (CGSize)sizeThatFitsiOS8:(CGSize)size
- {
- if ([[UIDevice currentDevice].systemVersion floatValue] >= 8) {
- @try {
- [self setNeedsLayout];
- [self layoutIfNeeded];
- }
- @catch (NSException *exception) {}
- CGSize new_size = [self.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize];
- return new_size;
- }
- return [self sizeThatFits:size];
- }
- @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement