How Do I Declare A Block in Objective-C?
As a local variable:
returnType (^blockName)(parameterTypes) = ^returnType(parameters) {...};
As a property:
@property (nonatomic, copy) returnType (^blockName)(parameterTypes);
+ (UIImage *)resizeImage:(UIImage *)image scaledToFitSize:(CGFloat)max | |
{ | |
NSData *imageData = [NSData dataWithData:UIImageJPEGRepresentation(image, 1.0)]; | |
CGImageSourceRef imageSource = CGImageSourceCreateWithData((__bridge CFDataRef)imageData, NULL); | |
if (!imageSource) | |
return nil; | |
CFDictionaryRef options = (__bridge CFDictionaryRef)[NSDictionary dictionaryWithObjectsAndKeys: | |
(id)kCFBooleanTrue, (id)kCGImageSourceCreateThumbnailWithTransform, | |
(id)kCFBooleanTrue, (id)kCGImageSourceCreateThumbnailFromImageIfAbsent, |
xcodebuild -scheme MyScheme -showBuildSettings | grep ARCHS |
Arabic (Saudi Arabia) - ar-SA | |
Chinese (China) - zh-CN | |
Chinese (Hong Kong SAR China) - zh-HK | |
Chinese (Taiwan) - zh-TW | |
Czech (Czech Republic) - cs-CZ | |
Danish (Denmark) - da-DK | |
Dutch (Belgium) - nl-BE | |
Dutch (Netherlands) - nl-NL | |
English (Australia) - en-AU | |
English (Ireland) - en-IE |
How Do I Declare A Block in Objective-C?
As a local variable:
returnType (^blockName)(parameterTypes) = ^returnType(parameters) {...};
As a property:
@property (nonatomic, copy) returnType (^blockName)(parameterTypes);
- (void)runSpinAnimationOnView:(UIView*)view duration:(CGFloat)duration rotations:(CGFloat)rotations repeat:(float)repeat; | |
{ | |
CABasicAnimation* rotationAnimation; | |
rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; | |
rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI * 2.0 /* full rotation*/ * rotations * duration ]; | |
rotationAnimation.duration = duration; | |
rotationAnimation.cumulative = YES; | |
rotationAnimation.repeatCount = repeat; | |
[view.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"]; |
#import "NoShadowTableView.h" | |
@interface NoShadowTableView () | |
{ | |
// iOS7 | |
__weak UIView* wrapperView; | |
} | |
@end |
NSUInteger DeviceSystemMajorVersion(); | |
NSUInteger DeviceSystemMajorVersion() | |
{ | |
static NSUInteger _deviceSystemMajorVersion = -1; | |
static dispatch_once_t onceToken; | |
dispatch_once(&onceToken, ^{ | |
_deviceSystemMajorVersion = [[[[[UIDevice currentDevice] systemVersion] componentsSeparatedByString:@"."] objectAtIndex:0] intValue]; | |
}); | |
return _deviceSystemMajorVersion; | |
} |
Pod::Spec.new do |s| | |
s.name = 'moves-ios-sdk' | |
s.version = '0.1.0' | |
s.platform = :ios,'6.0' | |
s.license = 'https://github.com/vitoziv/moves-ios-sdk/blob/master/LICENSE' | |
s.summary = 'Moves app iOS SDK ' | |
s.homepage = 'https://github.com/vitoziv/moves-ios-sdk' | |
s.author = { | |
'Vito Zhang' => '[email protected]' | |
} |
- (NSString *)convertTimeFromSeconds:(NSString *)seconds | |
{ | |
// Return variable. | |
NSString *result = @""; | |
// Int variables for calculation. | |
int secs = [seconds intValue]; | |
// Convert the seconds to hours, minutes and seconds. | |
int tempHour = secs / 3600; |
# OS X | |
.DS_Store | |
# Xcode | |
build/ | |
*.pbxuser | |
!default.pbxuser | |
*.mode1v3 | |
!default.mode1v3 | |
*.mode2v3 |