Created
October 31, 2013 16:34
-
-
Save austintaylor/7252793 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (CGFloat)cellWidthForStyle:(UITableViewStyle)style accessoryType:(UITableViewCellAccessoryType)accessoryType { | |
CGFloat width = self.view.frame.size.width; | |
CGFloat accessoryWidth; | |
CGFloat margin; | |
if (IOS7) { | |
if (accessoryType == UITableViewCellAccessoryDisclosureIndicator) { | |
accessoryWidth = 33; | |
} | |
} else { | |
if (accessoryType == UITableViewCellAccessoryDisclosureIndicator) { | |
accessoryWidth = 20; | |
} | |
if (width > 20) { | |
if (width < 400) { | |
margin = 10; | |
} else { | |
margin = MAX(31, MIN(45, width*0.06)); | |
} | |
} else { | |
margin = width - 10; | |
} | |
} | |
return width - (style == UITableViewStyleGrouped ? margin * 2 : 0) - accessoryWidth; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment