Partially converted to modern Objective-C

Signed-off-by: michael starke <michael.starke@hicknhack-software.com>
This commit is contained in:
michael starke
2015-10-23 19:14:05 +02:00
parent 4c91a55410
commit 0b073b96e0
5 changed files with 15 additions and 4 deletions

View File

@@ -106,10 +106,18 @@
default: default:
break; break;
} }
self.cell.controlSize = controlSize; if([self.superclass instancesRespondToSelector:@selector(setControlSize:)]) {
super.controlSize = controlSize;
}
else {
self.cell.controlSize = controlSize;
}
} }
- (NSControlSize)controlSize { - (NSControlSize)controlSize {
if([self.superclass instancesRespondToSelector:@selector(controlSize)]) {
return super.controlSize;
}
return self.cell.controlSize; return self.cell.controlSize;
} }

View File

@@ -64,6 +64,9 @@
} }
- (NSControlSize)controlSize { - (NSControlSize)controlSize {
if([self.superclass instancesRespondToSelector:@selector(controlSize)]) {
return super.controlSize;
}
return self.cell.controlSize; return self.cell.controlSize;
} }

View File

@@ -33,7 +33,7 @@
if(validateTarget) { if(validateTarget) {
isValid &= [validateTarget validateToolbarItem:self]; isValid &= [validateTarget validateToolbarItem:self];
} }
[self setEnabled:isValid]; self.enabled = isValid;
} }
} }
@end @end

View File

@@ -14,6 +14,6 @@ FOUNDATION_EXPORT NSString *const MPErrorDomain;
+ (NSError *)errorWithCode:(NSInteger)code description:(NSString *)description; + (NSError *)errorWithCode:(NSInteger)code description:(NSString *)description;
- (NSString *)descriptionForErrorCode; @property (nonatomic, readonly, copy) NSString *descriptionForErrorCode;
@end @end

View File

@@ -13,7 +13,7 @@ NSString *const MPErrorDomain = @"com.hicknhack.macpass.error";
@implementation NSError (Messages) @implementation NSError (Messages)
- (NSString *)descriptionForErrorCode { - (NSString *)descriptionForErrorCode {
return [NSString stringWithFormat:@"%@ (%ld)", [self localizedDescription], [self code] ]; return [NSString stringWithFormat:@"%@ (%ld)", self.localizedDescription, self.code ];
} }
+ (NSError *)errorWithCode:(NSInteger)code description:(NSString *)description { + (NSError *)errorWithCode:(NSInteger)code description:(NSString *)description {