-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathImageTitleDescriptionDisclosureTableViewCell.m
More file actions
58 lines (47 loc) · 1.82 KB
/
ImageTitleDescriptionDisclosureTableViewCell.m
File metadata and controls
58 lines (47 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//
// ImageTitleDescriptionDisclosureTableViewCell.m
// xolawareUI
//
// Created by me on 2012.04.08.
#include "xolawareOpenSourceCopyright.h" // Copyright (c) 2012 xolaware.
#import "ImageTitleDescriptionDisclosureTableViewCell.h"
@implementation ImageTitleDescriptionDisclosureTableViewCell
#pragma mark @synthesize
@synthesize itddImageView = _itddImageView;
@synthesize itddTitle = _itddTitle;
@synthesize itddDescription = _itddDescription;
@synthesize photoId = _photoId;
static CGFloat _storyboardFontSize;
- (BOOL)isEqual:(id)object
{
return [object isKindOfClass:[ImageTitleDescriptionDisclosureTableViewCell class]]
&& [[object photoId] isEqualToString:self.photoId];
}
- (void)normalizeFontSizeUsingCellAccessoryType:(UITableViewCellAccessoryType)reusedType
{
UIFont* titleFont = self.itddTitle.font;
if (!_storyboardFontSize)
_storyboardFontSize = titleFont.pointSize; // set once and re-use
CGFloat widthAdjustment = 0;;
if (reusedType != self.accessoryType)
switch (self.accessoryType)
{
case UITableViewCellAccessoryDetailDisclosureButton: widthAdjustment = 13; break;
case UITableViewCellAccessoryDisclosureIndicator: widthAdjustment = -13; break;
default:;
}
CGFloat actualFontSize, minFontSize;
if ([self.itddTitle respondsToSelector:@selector(minimumScaleFactor)])
minFontSize = self.itddTitle.minimumScaleFactor * _storyboardFontSize;
#if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_6_0
else
minFontSize = self.itddTitle.minimumFontSize;
#endif
[self.itddTitle.text sizeWithFont:[titleFont fontWithSize:_storyboardFontSize]
minFontSize:minFontSize
actualFontSize:&actualFontSize
forWidth:self.itddTitle.frame.size.width+widthAdjustment-2
lineBreakMode:NSLineBreakByWordWrapping];
self.itddTitle.font = [titleFont fontWithSize:(CGFloat)((int)actualFontSize)];
}
@end