-
Notifications
You must be signed in to change notification settings - Fork 450
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
666 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
Pod::Spec.new do |s| | ||
s.name = 'SUIMVVMKit' | ||
s.version = '0.1.1' | ||
s.version = '0.1.2' | ||
s.summary = 'SUIMVVMKit is a MVVM frameWork easy to develop iOS' | ||
s.homepage = 'https://github.com/lovemo/MVVMFramework' | ||
s.platform = :ios, '7.0' | ||
s.license = 'MIT' | ||
s.author = { 'lovemo' => '[email protected]' } | ||
s.source = { :git => 'https://github.com/lovemo/MVVMFramework.git',:tag => '0.1.1' } | ||
s.source = { :git => 'https://github.com/lovemo/MVVMFramework.git',:tag => '0.1.2' } | ||
s.requires_arc = true | ||
s.public_header_files = 'SUIMVVMKit/**/*.h' | ||
s.source_files = 'SUIMVVMKit/SUIMVVMKit.h' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// .h文件 | ||
#define MVVMSingletonH(name) + (instancetype)shared##name; | ||
|
||
// .m文件 | ||
#if __has_feature(objc_arc) | ||
|
||
#define MVVMSingletonM(name) \ | ||
static id _instace; \ | ||
\ | ||
+ (id)allocWithZone:(struct _NSZone *)zone \ | ||
{ \ | ||
static dispatch_once_t onceToken; \ | ||
dispatch_once(&onceToken, ^{ \ | ||
_instace = [super allocWithZone:zone]; \ | ||
}); \ | ||
return _instace; \ | ||
} \ | ||
\ | ||
+ (instancetype)shared##name \ | ||
{ \ | ||
static dispatch_once_t onceToken; \ | ||
dispatch_once(&onceToken, ^{ \ | ||
_instace = [[self alloc] init]; \ | ||
}); \ | ||
return _instace; \ | ||
} \ | ||
\ | ||
- (id)copyWithZone:(NSZone *)zone \ | ||
{ \ | ||
return _instace; \ | ||
} | ||
|
||
#else | ||
|
||
#define MVVMSingletonM(name) \ | ||
static id _instace; \ | ||
\ | ||
+ (id)allocWithZone:(struct _NSZone *)zone \ | ||
{ \ | ||
static dispatch_once_t onceToken; \ | ||
dispatch_once(&onceToken, ^{ \ | ||
_instace = [super allocWithZone:zone]; \ | ||
}); \ | ||
return _instace; \ | ||
} \ | ||
\ | ||
+ (instancetype)shared##name \ | ||
{ \ | ||
static dispatch_once_t onceToken; \ | ||
dispatch_once(&onceToken, ^{ \ | ||
_instace = [[self alloc] init]; \ | ||
}); \ | ||
return _instace; \ | ||
} \ | ||
\ | ||
- (id)copyWithZone:(NSZone *)zone \ | ||
{ \ | ||
return _instace; \ | ||
} \ | ||
\ | ||
- (oneway void)release { } \ | ||
- (id)retain { return self; } \ | ||
- (NSUInteger)retainCount { return 1;} \ | ||
- (id)autorelease { return self;} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// | ||
// MVVMHUD.h | ||
// SUIMVVMDemo | ||
// | ||
// Created by yuantao on 16/3/2. | ||
// Copyright © 2016年 lovemo. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
@interface MVVMHUD : NSObject | ||
|
||
#pragma mark - Customization | ||
|
||
+ (void)sui_setBackgroundColor:(UIColor*)color; // default is [UIColor whiteColor] | ||
+ (void)sui_setForegroundColor:(UIColor*)color; // default is [UIColor blackColor] | ||
+ (void)sui_setRingThickness:(CGFloat)width; // default is 4 pt | ||
+ (void)sui_setFont:(UIFont*)font; // default is [UIFont preferredFontForTextStyle:UIFontTextStyleSubheadline] | ||
+ (void)sui_setInfoImage:(UIImage*)image; // default is the bundled info image provided by Freepik | ||
+ (void)sui_setSuccessImage:(UIImage*)image; // default is the bundled success image provided by Freepik | ||
+ (void)sui_setErrorImage:(UIImage*)image; // default is the bundled error image provided by Freepik | ||
+ (void)sui_setDefaultMaskType:(SVProgressHUDMaskType)maskType; // default is SVProgressHUDMaskTypeNone | ||
+ (void)sui_setViewForExtension:(UIView*)view; // default is nil, only used if #define SV_APP_EXTENSIONS is set | ||
|
||
#pragma mark - Show Methods | ||
|
||
+ (void)sui_show; | ||
+ (void)sui_showWithMaskType:(SVProgressHUDMaskType)maskType; | ||
+ (void)sui_showWithStatus:(NSString*)status; | ||
+ (void)sui_showWithStatus:(NSString*)status maskType:(SVProgressHUDMaskType)maskType; | ||
|
||
+ (void)sui_showProgress:(float)progress; | ||
+ (void)sui_showProgress:(float)progress maskType:(SVProgressHUDMaskType)maskType; | ||
+ (void)sui_showProgress:(float)progress status:(NSString*)status; | ||
+ (void)sui_showProgress:(float)progress status:(NSString*)status maskType:(SVProgressHUDMaskType)maskType; | ||
|
||
+ (void)sui_setStatus:(NSString*)string; // change the HUD loading status while it's showing | ||
|
||
// stops the activity indicator, shows a glyph + status, and dismisses HUD a little bit later | ||
+ (void)sui_showInfoWithStatus:(NSString *)string; | ||
+ (void)sui_showInfoWithStatus:(NSString *)string maskType:(SVProgressHUDMaskType)maskType; | ||
|
||
+ (void)sui_showSuccessWithStatus:(NSString*)string; | ||
+ (void)sui_showSuccessWithStatus:(NSString*)string maskType:(SVProgressHUDMaskType)maskType; | ||
|
||
+ (void)sui_showErrorWithStatus:(NSString *)string; | ||
+ (void)sui_showErrorWithStatus:(NSString *)string maskType:(SVProgressHUDMaskType)maskType; | ||
|
||
// use 28x28 white pngs | ||
+ (void)sui_showImage:(UIImage*)image status:(NSString*)status; | ||
+ (void)sui_showImage:(UIImage*)image status:(NSString*)status maskType:(SVProgressHUDMaskType)maskType; | ||
|
||
+ (void)sui_setOffsetFromCenter:(UIOffset)offset; | ||
+ (void)sui_resetOffsetFromCenter; | ||
|
||
+ (void)sui_popActivity; // decrease activity count, if activity count == 0 the HUD is dismissed | ||
+ (void)sui_dismiss; | ||
|
||
+ (BOOL)sui_isVisible; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
// | ||
// MVVMHUD.m | ||
// SUIMVVMDemo | ||
// | ||
// Created by yuantao on 16/3/2. | ||
// Copyright © 2016年 lovemo. All rights reserved. | ||
// | ||
|
||
#import "MVVMHUD.h" | ||
|
||
@implementation MVVMHUD | ||
|
||
+ (void)sui_setBackgroundColor:(UIColor*)color { | ||
[SVProgressHUD setBackgroundColor:color]; | ||
} | ||
+ (void)sui_setForegroundColor:(UIColor*)color { | ||
[SVProgressHUD setForegroundColor:color]; | ||
} | ||
+ (void)sui_setRingThickness:(CGFloat)width { | ||
[SVProgressHUD setRingThickness:width]; | ||
} | ||
+ (void)sui_setFont:(UIFont*)font { | ||
[SVProgressHUD setFont:font]; | ||
} | ||
+ (void)sui_setInfoImage:(UIImage*)image { | ||
[SVProgressHUD setInfoImage:image]; | ||
} | ||
+ (void)sui_setSuccessImage:(UIImage*)image { | ||
[SVProgressHUD setSuccessImage:image]; | ||
} | ||
+ (void)sui_setErrorImage:(UIImage*)image { | ||
[SVProgressHUD setErrorImage:image]; | ||
} | ||
+ (void)sui_setDefaultMaskType:(SVProgressHUDMaskType)maskType { | ||
[SVProgressHUD setDefaultMaskType:maskType]; | ||
} | ||
+ (void)sui_setViewForExtension:(UIView*)view { | ||
[SVProgressHUD setViewForExtension:view]; | ||
} | ||
|
||
#pragma mark - Show Methods | ||
|
||
+ (void)sui_show { | ||
[SVProgressHUD show]; | ||
} | ||
+ (void)sui_showWithMaskType:(SVProgressHUDMaskType)maskType { | ||
[SVProgressHUD showWithMaskType:maskType]; | ||
} | ||
+ (void)sui_showWithStatus:(NSString*)status { | ||
[SVProgressHUD showWithStatus:status]; | ||
} | ||
+ (void)sui_showWithStatus:(NSString*)status maskType:(SVProgressHUDMaskType)maskType { | ||
[SVProgressHUD showWithStatus:status maskType:maskType]; | ||
} | ||
|
||
+ (void)sui_showProgress:(float)progress { | ||
[SVProgressHUD showProgress:progress]; | ||
} | ||
+ (void)sui_showProgress:(float)progress maskType:(SVProgressHUDMaskType)maskType { | ||
[SVProgressHUD showProgress:progress maskType:maskType]; | ||
} | ||
+ (void)sui_showProgress:(float)progress status:(NSString*)status { | ||
[SVProgressHUD showProgress:progress status:status]; | ||
} | ||
+ (void)sui_showProgress:(float)progress status:(NSString*)status maskType:(SVProgressHUDMaskType)maskType { | ||
[SVProgressHUD showProgress:progress status:status maskType:maskType]; | ||
} | ||
|
||
+ (void)sui_setStatus:(NSString*)string { | ||
[SVProgressHUD setStatus:string]; | ||
} | ||
// stops the activity indicator, shows a glyph + status, and dismisses HUD a little bit later | ||
+ (void)sui_showInfoWithStatus:(NSString *)string { | ||
[SVProgressHUD showInfoWithStatus:string]; | ||
} | ||
+ (void)sui_showInfoWithStatus:(NSString *)string maskType:(SVProgressHUDMaskType)maskType { | ||
[SVProgressHUD showWithStatus:string maskType:maskType]; | ||
} | ||
|
||
+ (void)sui_showSuccessWithStatus:(NSString*)string { | ||
[SVProgressHUD showSuccessWithStatus:string]; | ||
} | ||
+ (void)sui_showSuccessWithStatus:(NSString*)string maskType:(SVProgressHUDMaskType)maskType { | ||
[SVProgressHUD showSuccessWithStatus:string maskType:maskType]; | ||
} | ||
|
||
+ (void)sui_showErrorWithStatus:(NSString *)string { | ||
[SVProgressHUD showErrorWithStatus:string]; | ||
} | ||
+ (void)sui_showErrorWithStatus:(NSString *)string maskType:(SVProgressHUDMaskType)maskType { | ||
[SVProgressHUD showErrorWithStatus:string maskType:maskType]; | ||
} | ||
|
||
// use 28x28 white pngs | ||
+ (void)sui_showImage:(UIImage*)image status:(NSString*)status { | ||
[SVProgressHUD showImage:image status:status]; | ||
} | ||
+ (void)sui_showImage:(UIImage*)image status:(NSString*)status maskType:(SVProgressHUDMaskType)maskType { | ||
[SVProgressHUD showImage:image status:status maskType:maskType]; | ||
} | ||
|
||
+ (void)sui_setOffsetFromCenter:(UIOffset)offset { | ||
[SVProgressHUD setOffsetFromCenter:offset]; | ||
} | ||
+ (void)sui_resetOffsetFromCenter { | ||
[SVProgressHUD resetOffsetFromCenter]; | ||
} | ||
|
||
+ (void)sui_popActivity { | ||
[SVProgressHUD popActivity]; | ||
} | ||
+ (void)sui_dismiss { | ||
[SVProgressHUD dismiss]; | ||
} | ||
|
||
+ (BOOL)sui_isVisible { | ||
return [SVProgressHUD isVisible]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
// | ||
// UIImage+Extention.h | ||
// 常用分类功能 | ||
// | ||
// Created by mac on 15-1-4. | ||
// Copyright (c) 2015年 lijianyi. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@interface UIImage (Extention) | ||
/** | ||
* 图片不让系统渲染 | ||
* | ||
* @param image 图片 | ||
* | ||
* @return 不被系统渲染的图片 | ||
*/ | ||
+(UIImage*)imageOrginal:(UIImage*)image; | ||
/** | ||
* 裁剪带边框的圆形图片(当图片不是方正的,裁剪出来是椭圆,所以要求显示的imageView是方正的) | ||
* | ||
* @param image 图片 | ||
* @param borderWidth 边框尺寸 | ||
* @param borderColor 边框颜色 | ||
* | ||
* @return 裁剪好得图片 | ||
*/ | ||
|
||
+ (instancetype)circleImage:(UIImage*)image borderWidth:(CGFloat)borderWidth borderColor:(UIColor *)borderColor; | ||
/** | ||
* 最大化裁剪成圆图(当图片不是方正的,裁剪出来是椭圆,所以要求显示的imageView是方正的) | ||
* | ||
* @param image图片 | ||
* | ||
* @return 裁剪后的图片 | ||
*/ | ||
+(instancetype)circleImage:(UIImage*)image; | ||
/** | ||
* 水印logo,logo默认距离右上角10px | ||
* | ||
* @param image 图片 | ||
* @param logoName logo图片名 | ||
* @param size 将来logo的尺寸 | ||
* | ||
* @return 水印后的图片 | ||
*/ | ||
+(instancetype)image:(UIImage*)image andLogoImage:(NSString*)logoName andLogoSize:(CGSize)size; | ||
/** | ||
* 水印标题,标题默认位置,距离左上角10px | ||
* | ||
* @param image图片 | ||
* @param description 标题文字 | ||
* @param textColor 文字颜色 | ||
* @param backGroudColor 文字背景色 | ||
* @param size 文字大小 | ||
* | ||
* @return 水印标题后的图片 | ||
*/ | ||
+(instancetype)image:(UIImage*)image andDescription:(NSString*)description andColor:(UIColor*)textColor andColor:(UIColor*)backGroudColor andFontSize:(CGFloat) size; | ||
/** | ||
* 截屏 | ||
* | ||
* @param view 屏幕 | ||
* | ||
* @return 截取的图片 | ||
*/ | ||
|
||
+(UIImage*)subImage:(UIView*)view; | ||
/** | ||
* 不变形拉伸图片 | ||
* | ||
* @param image图片 | ||
* | ||
* @return 拉伸后的图片 | ||
*/ | ||
+(instancetype)resizebleImage:(UIImage*)image; | ||
/** | ||
* 根据CIImage生成指定大小的UIImage | ||
* | ||
* @param image CIImage | ||
* @param size 图片宽度 | ||
*/ | ||
+ (UIImage *)createNonInterpolatedUIImageFormCIImage:(CIImage *)image withSize:(CGFloat) size; | ||
@end |
Oops, something went wrong.