diff --git a/GCDiscreetNotificationView.podspec b/GCDiscreetNotificationView.podspec new file mode 100644 index 0000000..7875539 --- /dev/null +++ b/GCDiscreetNotificationView.podspec @@ -0,0 +1,10 @@ +Pod::Spec.new do |s| + s.name = 'GCDiscreetNotificationView' + s.version = '1.0' + s.license = 'MIT' + s.summary = 'GCDiscreetNotificationView is a discreet, non-modal, notification view for iOS' + s.homepage = 'https://github.com/gcamp/GCDiscreetNotificationView' + s.author = 'gcamp' + s.source = { :git => 'git@github.com:gcamp/GCDiscreetNotificationView.git' } + s.source_files = 'GCDiscreetNotificationView/*.{c,h,m,mm}' +end diff --git a/GCDiscreetNotificationView/GCDiscreetNotificationView.m b/GCDiscreetNotificationView/GCDiscreetNotificationView.m index d2bae8f..aa293f6 100644 --- a/GCDiscreetNotificationView/GCDiscreetNotificationView.m +++ b/GCDiscreetNotificationView/GCDiscreetNotificationView.m @@ -89,7 +89,12 @@ - (void) layoutSubviews { CGFloat maxLabelWidth = self.view.frame.size.width - self.activityIndicator.frame.size.width * withActivity - baseWidth; CGSize maxLabelSize = CGSizeMake(maxLabelWidth, GCDiscreetNotificationViewHeight); + +#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 CGFloat textSizeWidth = (self.textLabel != nil) ? [self.textLabel boundingRectWithSize:maxLabelSize options:NSStringDrawingTruncatesLastVisibleLine|NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:self.label.font} context:nil].size.width : 0; +#else + CGFloat textSizeWidth = (self.textLabel != nil) ? [self.textLabel sizeWithFont:self.label.font constrainedToSize:maxLabelSize].width : 0; +#endif CGFloat activityIndicatorWidth = (self.activityIndicator != nil) ? self.activityIndicator.frame.size.width : 0; CGRect bounds = CGRectMake(0, 0, baseWidth + textSizeWidth + activityIndicatorWidth, GCDiscreetNotificationViewHeight); @@ -405,4 +410,4 @@ - (void)willMoveToSuperview:(UIView *)newSuperview { } } -@end +@end \ No newline at end of file