Permalink
Browse files

warning supression

  • Loading branch information...
1 parent e3d94fb commit 99e4be03130c4b71f05e29ca31ebb7b95c39f67b @barrettj barrettj committed May 8, 2015
@@ -10,6 +10,7 @@
B5299D711AFA932C00A57DF0 /* alert-window-landscape.png in Resources */ = {isa = PBXBuildFile; fileRef = B5299D6F1AFA932C00A57DF0 /* alert-window-landscape.png */; };
B5299D721AFA932C00A57DF0 /* alert-window-landscape@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = B5299D701AFA932C00A57DF0 /* alert-window-landscape@2x.png */; };
B5422F0B1705EB6200CF13D7 /* BlockTableAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = B5422F0A1705EB6200CF13D7 /* BlockTableAlertView.m */; };
+ B556A26B1AFCEF6600244D9C /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = B556A26A1AFCEF6600244D9C /* Default-568h@2x.png */; };
B583D771175E3C31002A35C0 /* alert-green-button.png in Resources */ = {isa = PBXBuildFile; fileRef = B583D76F175E3C31002A35C0 /* alert-green-button.png */; };
B583D772175E3C31002A35C0 /* alert-green-button@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = B583D770175E3C31002A35C0 /* alert-green-button@2x.png */; };
B5D5B43A1760E4BB000B5F91 /* alert-yellow-button@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = B5D5B4391760E4BB000B5F91 /* alert-yellow-button@2x.png */; };
@@ -61,6 +62,7 @@
B5299D701AFA932C00A57DF0 /* alert-window-landscape@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "alert-window-landscape@2x.png"; sourceTree = "<group>"; };
B5422F091705EB6200CF13D7 /* BlockTableAlertView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlockTableAlertView.h; sourceTree = "<group>"; };
B5422F0A1705EB6200CF13D7 /* BlockTableAlertView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BlockTableAlertView.m; sourceTree = "<group>"; };
+ B556A26A1AFCEF6600244D9C /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = "<group>"; };
B583D76F175E3C31002A35C0 /* alert-green-button.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "alert-green-button.png"; sourceTree = "<group>"; };
B583D770175E3C31002A35C0 /* alert-green-button@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "alert-green-button@2x.png"; sourceTree = "<group>"; };
B5D5B4391760E4BB000B5F91 /* alert-yellow-button@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "alert-yellow-button@2x.png"; sourceTree = "<group>"; };
@@ -134,6 +136,7 @@
EC90168F14BB629F00EF52E1 = {
isa = PBXGroup;
children = (
+ B556A26A1AFCEF6600244D9C /* Default-568h@2x.png */,
EC9016A414BB629F00EF52E1 /* BlockAlertsDemo */,
EC90169D14BB629F00EF52E1 /* Frameworks */,
EC90169B14BB629F00EF52E1 /* Products */,
@@ -321,6 +324,7 @@
EC9016A914BB629F00EF52E1 /* InfoPlist.strings in Resources */,
EC9016B514BB629F00EF52E1 /* BlockAlertsDemoViewController.xib in Resources */,
EC9016E814BB679C00EF52E1 /* action-black-button-selected.png in Resources */,
+ B556A26B1AFCEF6600244D9C /* Default-568h@2x.png in Resources */,
EC9016E914BB679C00EF52E1 /* action-black-button-selected@2x.png in Resources */,
EC9016EA14BB679C00EF52E1 /* action-black-button.png in Resources */,
EC9016EB14BB679C00EF52E1 /* action-black-button@2x.png in Resources */,
@@ -120,7 +120,7 @@ - (IBAction)showTableAlert:(id)sender
return cell;
};
alert.didSelectRow = ^(BlockTableAlertView *alertView, NSInteger row){
- NSLog(@"Selected row: %d", row);
+ NSLog(@"Selected row: %ld", (long)row);
};
[alert show];
}
@@ -16,7 +16,10 @@
#ifndef IOS_LESS_THAN_6
#define IOS_LESS_THAN_6 !([[[UIDevice currentDevice] systemVersion] compare:@"6.0" options:NSNumericSearch] != NSOrderedAscending)
+#endif
+#ifndef IOS_LESS_THAN_7
+#define IOS_LESS_THAN_7 !([[[UIDevice currentDevice] systemVersion] compare:@"7.0" options:NSNumericSearch] != NSOrderedAscending)
#endif
#define NeedsLandscapePhoneTweaks (UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation]) && UI_USER_INTERFACE_IDIOM() != UIUserInterfaceIdiomPad)
@@ -50,9 +50,19 @@ - (id)initWithTitle:(NSString *)title
if (title)
{
- CGSize size = [title sizeWithFont:titleFont
- constrainedToSize:CGSizeMake(frame.size.width-kActionSheetBorder*2, 1000)
- lineBreakMode:NSLineBreakByWordWrapping];
+ CGSize size;
+ if (IOS_LESS_THAN_7) {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+ size = [title sizeWithFont:titleFont constrainedToSize:CGSizeMake(frame.size.width-kActionSheetBorder*2, 1000) lineBreakMode:NSLineBreakByWordWrapping];
+#pragma clang diagnostic pop
+ }
+ else {
+ NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
+ paragraphStyle.lineBreakMode = NSLineBreakByWordWrapping;
+ size = [title boundingRectWithSize:CGSizeMake(frame.size.width-kAlertViewBorder*2, 1000) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSParagraphStyleAttributeName : paragraphStyle, NSFontAttributeName : titleFont} context:nil].size;
+ size = CGSizeMake(ceilf(size.width), ceilf(size.height));
+ }
UILabel *labelView = [[UILabel alloc] initWithFrame:CGRectMake(kActionSheetBorder, _height, frame.size.width-kActionSheetBorder*2, size.height)];
labelView.font = titleFont;
@@ -158,10 +168,10 @@ - (void)showInView:(UIView *)view
button.frame = CGRectMake(kActionSheetBorder, _height, _view.bounds.size.width-kActionSheetBorder*2, kActionSheetButtonHeight);
button.titleLabel.font = buttonFont;
if (IOS_LESS_THAN_6) {
-#pragma clan diagnostic push
+#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
button.titleLabel.minimumFontSize = 10;
-#pragma clan diagnostic pop
+#pragma clang diagnostic pop
}
else {
button.titleLabel.minimumScaleFactor = 0.1;
@@ -266,7 +276,7 @@ - (void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)anim
- (void)buttonClicked:(id)sender
{
/* Run the button's block */
- int buttonIndex = [(UIButton *)sender tag] - 1;
+ NSInteger buttonIndex = [(UIButton *)sender tag] - 1;
[self dismissWithClickedButtonIndex:buttonIndex animated:YES];
}
@@ -65,9 +65,19 @@ + (void)showErrorAlert:(NSError *)error
- (void)addComponents:(CGRect)frame {
if (_title)
{
- CGSize size = [_title sizeWithFont:titleFont
- constrainedToSize:CGSizeMake(frame.size.width-kAlertViewBorder*2, 1000)
- lineBreakMode:NSLineBreakByWordWrapping];
+ CGSize size;
+ if (IOS_LESS_THAN_7) {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+ size = [_title sizeWithFont:titleFont constrainedToSize:CGSizeMake(frame.size.width-kAlertViewBorder*2, 1000) lineBreakMode:NSLineBreakByWordWrapping];
+#pragma clang diagnostic pop
+ }
+ else {
+ NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
+ paragraphStyle.lineBreakMode = NSLineBreakByWordWrapping;
+ size = [_title boundingRectWithSize:CGSizeMake(frame.size.width-kAlertViewBorder*2, 1000) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSParagraphStyleAttributeName : paragraphStyle, NSFontAttributeName : titleFont} context:nil].size;
+ size = CGSizeMake(ceilf(size.width), ceilf(size.height));
+ }
UILabel *labelView = [[UILabel alloc] initWithFrame:CGRectMake(kAlertViewBorder, _height, frame.size.width-kAlertViewBorder*2, size.height)];
labelView.font = titleFont;
@@ -87,9 +97,19 @@ - (void)addComponents:(CGRect)frame {
if (_message)
{
- CGSize size = [_message sizeWithFont:messageFont
- constrainedToSize:CGSizeMake(frame.size.width-kAlertViewBorder*2, 1000)
- lineBreakMode:NSLineBreakByWordWrapping];
+ CGSize size;
+ if (IOS_LESS_THAN_7) {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+ size = [_message sizeWithFont:messageFont constrainedToSize:CGSizeMake(frame.size.width-kAlertViewBorder*2, 1000) lineBreakMode:NSLineBreakByWordWrapping];
+#pragma clang diagnostic pop
+ }
+ else {
+ NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
+ paragraphStyle.lineBreakMode = NSLineBreakByWordWrapping;
+ size = [_message boundingRectWithSize:CGSizeMake(frame.size.width-kAlertViewBorder*2, 1000) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSParagraphStyleAttributeName : paragraphStyle, NSFontAttributeName : messageFont} context:nil].size;
+ size = CGSizeMake(ceilf(size.width), ceilf(size.height));
+ }
UILabel *labelView = [[UILabel alloc] initWithFrame:CGRectMake(kAlertViewBorder, _height, frame.size.width-kAlertViewBorder*2, size.height)];
labelView.font = messageFont;
@@ -246,22 +266,37 @@ - (void)show
{
// In this case there's another button.
// Let's check if they fit on the same line.
- CGSize size = [title sizeWithFont:buttonFont
- minFontSize:10
- actualFontSize:nil
- forWidth:_view.bounds.size.width-kAlertViewBorder*2
- lineBreakMode:NSLineBreakByClipping];
+ CGSize size;
+ if (IOS_LESS_THAN_7) {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+ size = [title sizeWithFont:buttonFont minFontSize:10 actualFontSize:nil forWidth:_view.bounds.size.width-kAlertViewBorder*2 lineBreakMode:NSLineBreakByClipping];
+#pragma clang diagnostic pop
+ }
+ else {
+ NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
+ paragraphStyle.lineBreakMode = NSLineBreakByClipping;
+ size = [title boundingRectWithSize:CGSizeMake(_view.bounds.size.width-kAlertViewBorder*2, _height) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSParagraphStyleAttributeName : paragraphStyle,NSFontAttributeName : buttonFont} context:nil].size;
+ size = CGSizeMake(ceilf(size.width), ceilf(size.height));
+ }
if (size.width < maxHalfWidth - kAlertViewBorder)
{
// It might fit. Check the next Button
NSArray *block2 = [_blocks objectAtIndex:i+1];
NSString *title2 = [block2 objectAtIndex:1];
- size = [title2 sizeWithFont:buttonFont
- minFontSize:10
- actualFontSize:nil
- forWidth:_view.bounds.size.width-kAlertViewBorder*2
- lineBreakMode:NSLineBreakByClipping];
+ if (IOS_LESS_THAN_7) {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+ size = [title2 sizeWithFont:buttonFont minFontSize:10 actualFontSize:nil forWidth:_view.bounds.size.width-kAlertViewBorder*2 lineBreakMode:NSLineBreakByClipping];
+#pragma clang diagnostic pop
+ }
+ else {
+ NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
+ paragraphStyle.lineBreakMode = NSLineBreakByClipping;
+ size = [title2 boundingRectWithSize:CGSizeMake(_view.bounds.size.width-kAlertViewBorder*2, _height) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSParagraphStyleAttributeName : paragraphStyle, NSFontAttributeName : buttonFont} context:nil].size;
+ size = CGSizeMake(ceilf(size.width), ceilf(size.height));
+ }
if (size.width < maxHalfWidth - kAlertViewBorder)
{
@@ -274,11 +309,19 @@ - (void)show
else if (_blocks.count == 1)
{
// In this case this is the ony button. We'll size according to the text
- CGSize size = [title sizeWithFont:buttonFont
- minFontSize:10
- actualFontSize:nil
- forWidth:_view.bounds.size.width-kAlertViewBorder*2
- lineBreakMode:NSLineBreakByClipping];
+ CGSize size;
+ if (IOS_LESS_THAN_7) {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+ size = [title sizeWithFont:buttonFont minFontSize:10 actualFontSize:nil forWidth:_view.bounds.size.width-kAlertViewBorder*2 lineBreakMode:NSLineBreakByClipping];
+#pragma clang diagnostic pop
+ }
+ else {
+ NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
+ paragraphStyle.lineBreakMode = NSLineBreakByClipping;
+ size = [title boundingRectWithSize:CGSizeMake(_view.bounds.size.width-kAlertViewBorder*2, _height) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSParagraphStyleAttributeName : paragraphStyle, NSFontAttributeName : buttonFont} context:nil].size;
+ size = CGSizeMake(ceilf(size.width), ceilf(size.height));
+ }
size.width = MAX(size.width, 80);
if (size.width + 2 * kAlertViewBorder < width)
@@ -292,14 +335,14 @@ - (void)show
button.frame = CGRectMake(xOffset, _height, width, kAlertButtonHeight);
button.titleLabel.font = buttonFont;
if (IOS_LESS_THAN_6) {
-#pragma clan diagnostic push
+#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
button.titleLabel.minimumFontSize = 10;
-#pragma clan diagnostic pop
+ button.titleLabel.adjustsLetterSpacingToFitWidth = YES;
+#pragma clang diagnostic pop
}
else {
button.titleLabel.adjustsFontSizeToFitWidth = YES;
- button.titleLabel.adjustsLetterSpacingToFitWidth = YES;
button.titleLabel.minimumScaleFactor = 0.1;
}
button.titleLabel.textAlignment = NSTextAlignmentCenter;
@@ -458,7 +501,7 @@ - (void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)anim
- (void)buttonClicked:(id)sender
{
/* Run the button's block */
- int buttonIndex = [(UIButton *)sender tag] - 1;
+ NSInteger buttonIndex = [(UIButton *)sender tag] - 1;
[self dismissWithClickedButtonIndex:buttonIndex animated:YES];
}
@@ -52,7 +52,7 @@ - (id)retain
return self;
}
-- (unsigned)retainCount
+- (NSUInteger)retainCount
{
return UINT_MAX;
}
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 99e4be0

Please sign in to comment.