Skip to content

Instantly share code, notes, and snippets.

View vitoziv's full-sized avatar
🐙
Writing bugs

Vito vitoziv

🐙
Writing bugs
View GitHub Profile
@vitoziv
vitoziv / search_archs
Created March 20, 2014 06:16
find ARCHS in build setting
xcodebuild -scheme MyScheme -showBuildSettings | grep ARCHS
@vitoziv
vitoziv / UIImage+VI_Resize.m
Created July 4, 2014 06:22
Resize Image With low memory
+ (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,
@vitoziv
vitoziv / EvernoteSDK.podspec
Last active December 18, 2015 03:58
EvernoteSDK改进版
Pod::Spec.new do |s|
s.name = 'SIEvernoteSDK'
s.version = '1.0'
s.platform = :ios,'5.0'
s.license = 'https://github.com/evernote/evernote-sdk-ios/blob/master/LICENSE'
s.summary = 'EvernoteSDK改进版'
s.homepage = 'https://github.com/vitoziv/evernote-sdk-ios'
s.author = { 'Vito Zhang' => 'zhangwei.noair@gmail.com' }
s.requires_arc = true
s.source = { :git => 'https://github.com/vitoziv/evernote-sdk-ios.git', :tag => '1.2.0' }
@vitoziv
vitoziv / .gitignore_global
Created November 12, 2013 12:20
.gitignore_global
# Mac
*~
.DS_Store
.AppleDouble
.LSOverride
# Thumbnails
._*
# Files that might appear on external disk
# OS X
.DS_Store
# Xcode
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
@vitoziv
vitoziv / convertTimeFromSeconds.m
Last active December 28, 2015 09:48
convertTimeFromSeconds.m
- (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;
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' => 'zhangwei.noair@gmail.com'
}
@vitoziv
vitoziv / IS IOS7 Version
Created December 11, 2013 06:47
IS IOS7 Version
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;
}
@vitoziv
vitoziv / NoShadowTableView.m
Created December 11, 2013 07:36
NoShadowTableView - Removing reorder cell shadows from a UITableView
#import "NoShadowTableView.h"
@interface NoShadowTableView ()
{
// iOS7
__weak UIView* wrapperView;
}
@end
@vitoziv
vitoziv / rotationAnimation.m
Created December 16, 2013 08:11
360℃旋转动画
- (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"];