Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix deprecation warnings in iOS 6. #141

Merged
merged 1 commit into from

2 participants

@jyap808

Fix deprecation warnings in iOS 6.

@soffes
Owner

Solid. Thanks!

@soffes soffes merged commit f811900 into soffes:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 6, 2012
  1. @jyap808
This page is out of date. Refresh to see the latest.
View
11 SSToolkit/SSBadgeView.h
@@ -10,6 +10,16 @@
Options for aligning the badge horizontally.
*/
typedef enum {
+#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_6_0
+ /** Align badge along the left edge. */
+ SSBadgeViewAlignmentLeft = NSTextAlignmentLeft,
+
+ /** Align badge equally along both sides of the center line. */
+ SSBadgeViewAlignmentCenter = NSTextAlignmentCenter,
+
+ /** Align badge along the right edge. */
+ SSBadgeViewAlignmentRight = NSTextAlignmentRight
+#else
/** Align badge along the left edge. */
SSBadgeViewAlignmentLeft = UITextAlignmentLeft,
@@ -18,6 +28,7 @@ typedef enum {
/** Align badge along the right edge. */
SSBadgeViewAlignmentRight = UITextAlignmentRight
+#endif
} SSBadgeViewAlignment;
@class SSLabel;
View
4 SSToolkit/SSBadgeView.m
@@ -169,7 +169,11 @@ - (void)_initialize {
_textLabel.textColor = [UIColor whiteColor];
_textLabel.highlightedTextColor = [UIColor colorWithRed:0.125f green:0.369f blue:0.871f alpha:1.0f];
_textLabel.font = [UIFont boldSystemFontOfSize:16.0f];
+#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_6_0
+ _textLabel.textAlignment = NSTextAlignmentCenter;
+#else
_textLabel.textAlignment = UITextAlignmentCenter;
+#endif
self.badgeColor = [[self class] defaultBadgeColor];
self.highlightedBadgeColor = [UIColor whiteColor];
View
10 SSToolkit/SSCollectionViewItem.m
@@ -115,12 +115,20 @@ - (id)initWithStyle:(SSCollectionViewItemStyle)style reuseIdentifier:(NSString *
if (_style != SSCollectionViewItemStyleBlank) {
if (_style == SSCollectionViewItemStyleSubtitle) {
_detailTextLabel = [[SSLabel alloc] initWithFrame:CGRectZero];
+#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_6_0
+ _detailTextLabel.textAlignment = NSTextAlignmentCenter;
+#else
_detailTextLabel.textAlignment = UITextAlignmentCenter;
+#endif
[self addSubview:_detailTextLabel];
}
_textLabel = [[SSLabel alloc] initWithFrame:CGRectZero];
- _textLabel.textAlignment = UITextAlignmentCenter;
+#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_6_0
+ _textLabel.textAlignment = NSTextAlignmentCenter;
+#else
+ _textLabel.textAlignment = UITextAlignmentCenter;
+#endif
[self addSubview:_textLabel];
_imageView = [[UIImageView alloc] initWithFrame:CGRectZero];
View
9 SSToolkit/SSHUDView.m
@@ -111,7 +111,11 @@ - (void)drawRect:(CGRect)rect {
CGRect dingbatRect = CGRectMake(roundf((_hudSize.width - dingbatSize.width) / 2.0f),
roundf((_hudSize.height - dingbatSize.height) / 2.0f),
dingbatSize.width, dingbatSize.height);
+#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_6_0
+ [dingbat drawInRect:dingbatRect withFont:dingbatFont lineBreakMode:NSLineBreakByClipping alignment:NSTextAlignmentCenter];
+#else
[dingbat drawInRect:dingbatRect withFont:dingbatFont lineBreakMode:UILineBreakModeClip alignment:UITextAlignmentCenter];
+#endif
}
}
@@ -156,8 +160,13 @@ - (id)initWithTitle:(NSString *)aTitle loading:(BOOL)isLoading {
_textLabel.textColor = [UIColor whiteColor];
_textLabel.shadowColor = [UIColor colorWithWhite:0.0f alpha:0.7f];
_textLabel.shadowOffset = CGSizeMake(0.0f, 1.0f);
+#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_6_0
+ _textLabel.textAlignment = NSTextAlignmentCenter;
+ _textLabel.lineBreakMode = NSLineBreakByTruncatingTail;
+#else
_textLabel.textAlignment = UITextAlignmentCenter;
_textLabel.lineBreakMode = UILineBreakModeTailTruncation;
+#endif
_textLabel.text = aTitle ? aTitle : SSToolkitLocalizedString(@"Loading...");
[self addSubview:_textLabel];
View
5 SSToolkit/SSLoadingView.m
@@ -50,8 +50,13 @@ - (void)drawRect:(CGRect)rect {
CGSize maxSize = CGSizeMake(frame.size.width - (interiorPadding * 2.0f) - indicatorSize - indicatorRightMargin,
indicatorSize);
+#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_6_0
+ CGSize textSize = [_textLabel.text sizeWithFont:_textLabel.font constrainedToSize:maxSize
+ lineBreakMode:NSLineBreakByWordWrapping];
+#else
CGSize textSize = [_textLabel.text sizeWithFont:_textLabel.font constrainedToSize:maxSize
lineBreakMode:UILineBreakModeWordWrap];
+#endif
// Calculate position
CGFloat totalWidth = textSize.width + indicatorSize + indicatorRightMargin;
View
4 SSToolkit/SSRatingPicker.m
@@ -162,7 +162,11 @@ - (void)_initialize {
_textLabel.backgroundColor = [UIColor clearColor];
_textLabel.text = @"Tap a Star to Rate";
_textLabel.font = [UIFont boldSystemFontOfSize:10.0f];
+#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_6_0
+ _textLabel.textAlignment = NSTextAlignmentCenter;
+#else
_textLabel.textAlignment = UITextAlignmentCenter;
+#endif
[self addSubview:_textLabel];
}
View
4 SSToolkit/SSTextField.m
@@ -74,7 +74,11 @@ - (void)drawPlaceholderInRect:(CGRect)rect {
}
[_placeholderTextColor setFill];
+#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_6_0
+ [self.placeholder drawInRect:rect withFont:self.font lineBreakMode:NSLineBreakByTruncatingTail alignment:self.textAlignment];
+#else
[self.placeholder drawInRect:rect withFont:self.font lineBreakMode:UILineBreakModeTailTruncation alignment:self.textAlignment];
+#endif
}
Something went wrong with that request. Please try again.