diff --git a/TDBadgedCell.podspec b/TDBadgedCell.podspec index 5c522b4..b025152 100644 --- a/TDBadgedCell.podspec +++ b/TDBadgedCell.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TDBadgedCell' - s.version = '5.2' + s.version = '5.2.1' s.license = { :type => 'MIT', :file => 'LICENSE' } s.summary = 'UITableViewCell subclass that adds a "badgeString" property to table view cells.' s.description = <<-DESC diff --git a/TDBadgedCell/TDBadgedCell.swift b/TDBadgedCell/TDBadgedCell.swift index 11f6308..c21848b 100644 --- a/TDBadgedCell/TDBadgedCell.swift +++ b/TDBadgedCell/TDBadgedCell.swift @@ -56,10 +56,14 @@ open class TDBadgedCell: UITableViewCell { badgeView.frame.origin.y = floor((frame.height / 2) - (badgeView.frame.height / 2)) // Now lets update the width of the cells text labels to take the badge into account - let labelWidth = self.contentView.frame.width - (badgeView.frame.width + (offsetX * 2)) - 20; - textLabel?.frame.size.width = labelWidth - if((detailTextLabel) != nil) { - detailTextLabel?.frame.size.width = labelWidth + let labelWidth = self.contentView.frame.width - (badgeView.frame.width + (offsetX * 2)); + + if textLabel != nil { + textLabel!.frame.size.width = labelWidth - textLabel!.frame.origin.x + } + + if detailTextLabel != nil { + detailTextLabel!.frame.size.width = labelWidth - detailTextLabel!.frame.origin.x } }