├── .gitignore
├── LICENSE
├── README.md
├── SCFramework.podspec
└── SCFramework
├── Podfile
├── Podfile.lock
├── SCFramework.xcodeproj
├── project.pbxproj
├── project.xcworkspace
│ └── contents.xcworkspacedata
└── xcshareddata
│ └── xcschemes
│ └── SCFramework.xcscheme
├── SCFramework.xcworkspace
└── contents.xcworkspacedata
├── SCFramework
├── AppDelegate.h
├── AppDelegate.m
├── Images.xcassets
│ ├── AppIcon.appiconset
│ │ └── Contents.json
│ └── LaunchImage.launchimage
│ │ └── Contents.json
├── InfoPlist.strings
├── SCDemoDetailViewController.h
├── SCDemoDetailViewController.m
├── SCDemoListViewController.h
├── SCDemoListViewController.m
├── SCFramework-Info.plist
├── SCFramework-Prefix.pch
├── SCFramework
│ ├── Adapted
│ │ ├── AdaptedDevice
│ │ │ ├── SCAdaptedDevice.h
│ │ │ └── SCAdaptedDevice.m
│ │ └── AdaptedSystem
│ │ │ ├── SCAdaptedSystem.h
│ │ │ └── SCAdaptedSystem.m
│ ├── Category
│ │ ├── NSArray+SCAddition.h
│ │ ├── NSArray+SCAddition.m
│ │ ├── NSAttributedString+SCAddition.h
│ │ ├── NSAttributedString+SCAddition.m
│ │ ├── NSData+SCAddition.h
│ │ ├── NSData+SCAddition.m
│ │ ├── NSDate+SCAddition.h
│ │ ├── NSDate+SCAddition.m
│ │ ├── NSDictionary+SCAddition.h
│ │ ├── NSDictionary+SCAddition.m
│ │ ├── NSObject+SCAddition.h
│ │ ├── NSObject+SCAddition.m
│ │ ├── NSString+SCAddition.h
│ │ ├── NSString+SCAddition.m
│ │ ├── NSTimer+SCAddition.h
│ │ ├── NSTimer+SCAddition.m
│ │ ├── NSURL+SCAddition.h
│ │ ├── NSURL+SCAddition.m
│ │ ├── UIAlertView+SCAddition.h
│ │ ├── UIAlertView+SCAddition.m
│ │ ├── UIBarButtonItem+SCAddition.h
│ │ ├── UIBarButtonItem+SCAddition.m
│ │ ├── UIColor+SCAddition.h
│ │ ├── UIColor+SCAddition.m
│ │ ├── UIDevice+SCAddition.h
│ │ ├── UIDevice+SCAddition.m
│ │ ├── UIImage+SCAddition.h
│ │ ├── UIImage+SCAddition.m
│ │ ├── UINavigationController+SCAddition.h
│ │ ├── UINavigationController+SCAddition.m
│ │ ├── UINavigationItem+SCAddition.h
│ │ ├── UINavigationItem+SCAddition.m
│ │ ├── UIScreen+SCAddition.h
│ │ ├── UIScreen+SCAddition.m
│ │ ├── UITableView+SCAddition.h
│ │ ├── UITableView+SCAddition.m
│ │ ├── UIView+SCAddition.h
│ │ └── UIView+SCAddition.m
│ ├── Common
│ │ ├── App
│ │ │ ├── SCApp.h
│ │ │ └── SCApp.m
│ │ ├── Foundation
│ │ │ ├── SCJSONSerializing.h
│ │ │ ├── SCModel.h
│ │ │ ├── SCModel.m
│ │ │ ├── SCNSJSONSerialization.h
│ │ │ └── SCNSJSONSerialization.m
│ │ ├── Math
│ │ │ ├── SCMath.h
│ │ │ └── SCMath.m
│ │ └── Utils
│ │ │ ├── SCUtils.h
│ │ │ └── SCUtils.m
│ ├── Constant
│ │ ├── SCConstant.h
│ │ └── SCConstant.m
│ ├── Manager
│ │ ├── DaoManager
│ │ │ ├── NSFetchRequest+SCDaoAddition.h
│ │ │ ├── NSFetchRequest+SCDaoAddition.m
│ │ │ ├── NSManagedObject+SCDaoAddition.h
│ │ │ ├── NSManagedObject+SCDaoAddition.m
│ │ │ ├── SCCoreDataManager.h
│ │ │ ├── SCCoreDataManager.m
│ │ │ ├── SCDaoManager.h
│ │ │ ├── SCDaoManager.m
│ │ │ ├── SCDatabase.h
│ │ │ ├── SCDatabase.m
│ │ │ ├── SCDatabaseManager.h
│ │ │ ├── SCDatabaseManager.m
│ │ │ ├── SCDatabaseMetaModel.h
│ │ │ ├── SCDatabaseMetaModel.m
│ │ │ ├── SCDatabaseModel.h
│ │ │ ├── SCKeyValueStore.h
│ │ │ ├── SCKeyValueStore.m
│ │ │ ├── SCTableMetaModel.h
│ │ │ └── SCTableMetaModel.m
│ │ ├── DateManager
│ │ │ ├── SCDateManager.h
│ │ │ └── SCDateManager.m
│ │ ├── FileManager
│ │ │ ├── SCFileManager.h
│ │ │ └── SCFileManager.m
│ │ ├── ImagePickerManager
│ │ │ ├── SCImagePickerManager.h
│ │ │ └── SCImagePickerManager.m
│ │ ├── LocationManager
│ │ │ ├── SCLocationManager.h
│ │ │ └── SCLocationManager.m
│ │ ├── UserDefaultManager
│ │ │ ├── SCUserDefaultManager.h
│ │ │ └── SCUserDefaultManager.m
│ │ └── VersionManager
│ │ │ ├── SCVersionManager.h
│ │ │ └── SCVersionManager.m
│ ├── SCConfig.h
│ ├── SCFramework.h
│ ├── SCLog.h
│ ├── SCMacro.h
│ ├── SCSingleton.h
│ ├── ViewControllers
│ │ ├── SCNavigationController
│ │ │ ├── SCCTNavigationController.h
│ │ │ ├── SCCTNavigationController.m
│ │ │ ├── SCCTNavigationControllerDelegateManager.h
│ │ │ ├── SCCTNavigationControllerDelegateManager.m
│ │ │ ├── SCDBNavigationController.h
│ │ │ ├── SCDBNavigationController.m
│ │ │ ├── SCNavigationController.h
│ │ │ ├── SCNavigationController.m
│ │ │ ├── SCViewControllerTransition.h
│ │ │ ├── SCViewControllerTransitionAnimator.h
│ │ │ └── SCViewControllerTransitionAnimator.m
│ │ ├── SCPageViewController
│ │ │ ├── SCPageViewController.h
│ │ │ └── SCPageViewController.m
│ │ ├── SCTabBarController
│ │ │ ├── SCTabBarController.h
│ │ │ └── SCTabBarController.m
│ │ ├── SCTableViewController
│ │ │ ├── SCTableViewController.h
│ │ │ └── SCTableViewController.m
│ │ └── SCViewController
│ │ │ ├── SCViewController.h
│ │ │ └── SCViewController.m
│ ├── Views
│ │ ├── SCActionSheet
│ │ │ ├── SCActionSheet.h
│ │ │ └── SCActionSheet.m
│ │ ├── SCAlertView
│ │ │ ├── SCAlertView.h
│ │ │ └── SCAlertView.m
│ │ ├── SCButton
│ │ │ ├── SCButton.h
│ │ │ └── SCButton.m
│ │ ├── SCDatePicker
│ │ │ ├── SCDatePicker.h
│ │ │ └── SCDatePicker.m
│ │ ├── SCLabel
│ │ │ ├── SCLabel.h
│ │ │ └── SCLabel.m
│ │ ├── SCPageControl
│ │ │ ├── SCPageControl.h
│ │ │ └── SCPageControl.m
│ │ ├── SCPickerView
│ │ │ ├── SCPickerView.h
│ │ │ └── SCPickerView.m
│ │ ├── SCScrollView
│ │ │ ├── SCBrowseView.h
│ │ │ ├── SCBrowseView.m
│ │ │ ├── SCBrowseViewPage.h
│ │ │ ├── SCBrowseViewPage.m
│ │ │ ├── SCCycleScrollView.h
│ │ │ ├── SCCycleScrollView.m
│ │ │ ├── SCScrollView.h
│ │ │ └── SCScrollView.m
│ │ ├── SCTableView
│ │ │ ├── SCCircleView.h
│ │ │ ├── SCCircleView.m
│ │ │ ├── SCExpandTableView.h
│ │ │ ├── SCExpandTableView.m
│ │ │ ├── SCPullLoadView.h
│ │ │ ├── SCPullLoadView.m
│ │ │ ├── SCPullRefreshView.h
│ │ │ ├── SCPullRefreshView.m
│ │ │ ├── SCTableView.h
│ │ │ └── SCTableView.m
│ │ ├── SCTableViewCell
│ │ │ ├── SCExpandTableViewCell.h
│ │ │ ├── SCExpandTableViewCell.m
│ │ │ ├── SCTableViewCell.h
│ │ │ └── SCTableViewCell.m
│ │ ├── SCTextField
│ │ │ ├── SCTextField.h
│ │ │ └── SCTextField.m
│ │ ├── SCTextView
│ │ │ ├── SCTextView.h
│ │ │ └── SCTextView.m
│ │ ├── SCToolbar
│ │ │ ├── SCToolbar.h
│ │ │ └── SCToolbar.m
│ │ └── SCView
│ │ │ ├── SCActionView.h
│ │ │ ├── SCActionView.m
│ │ │ ├── SCView.h
│ │ │ └── SCView.m
│ ├── en.lproj
│ │ └── SCFWLocalizable.strings
│ └── zh-Hans.lproj
│ │ └── SCFWLocalizable.strings
├── TestPic.jpg
└── main.m
└── SCFrameworkTests
├── SCFrameworkTests-Info.plist
├── SCFrameworkTests.m
└── en.lproj
└── InfoPlist.strings
/.gitignore:
--------------------------------------------------------------------------------
1 | SCFramework/SCFramework.xcworkspace/xcuserdata/richervc1.xcuserdatad
2 | SCFramework/SCFramework.xcodeproj/xcuserdata/richervc1.xcuserdatad
3 | SCFramework/SCFramework.xcworkspace/xcshareddata
4 | xcschememanagement.plist
5 | SCFramework/Pods
6 | SCFramework/.idea
7 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2014-2015 Angzn - https://github.com/kangchuh
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | SCFramework
2 | ===========
3 |
4 | SCFramework 是一个常用类封装和扩展的集合,主要包含常用类别、常用基类。
5 |
6 | Introduction
7 | ===========
8 |
9 | SCFramework 是一个基于ARC常用类封装和扩展的集合。主要包含Adapted、Category、Common、Constant、Manager、Resources、ViewControllers、Views几大分类。结构如下:
10 |
- **Adapted**
11 |
- **Category**
12 |
- **Common**
13 |
- **Constant**
14 |
- **Manager**
15 |
- **ViewControllers**
16 |
- **Views**
17 |
18 | 适配类
19 | -------------
20 | AdaptedDevice-设备适配
21 | AdaptedSystem-系统适配
22 |
23 | 类别类
24 | -------------
25 | 常用类的扩展,如:
26 | *NSArray*、
27 | *NSData*、
28 | *NSDate*、
29 | *NSDictionary*、
30 | *NSObject*、
31 | *NSString*、
32 | *NSTimer*、
33 | *NSURL*、
34 | *UIAlertView*、
35 | *UIColor*、
36 | *UIDevice*、
37 | *UIImage*、
38 | *UIView*、
39 | *UITableView*、
40 | *UIScreen*、
41 | *UIBarButtonItem*、
42 | *UINavigationItem*、
43 | *UINavigationController* 等
44 |
45 | 通用类
46 | -------------
47 | SCApp-App的常用方法
48 | SCModel-数据模型基类
49 | SCMath-数学常用方法
50 | SCUtils-工具类
51 |
52 | 常量类
53 | -------------
54 | SCConstant-常量类
55 |
56 | 管理类
57 | -------------
58 | SCDaoManager-数据库操作工具类
59 | SCDateManager-日期与时间操作工具类
60 | SCFileManager-文件操作工具类
61 | SCImagePickerManager-照片库与照相机操作工具类
62 | SCLocationManager-定位工具类
63 | SCUserDefaultManager-用户设置工具类
64 | SCVersionManager-版本管理工具类
65 |
66 | 视图控制器类
67 | -------------
68 | SCNavigationController-导航控制器类,添加了自定义返回手势
69 | SCTableViewController-列表视图控制器类,支持下拉刷新和上拉加载
70 |
71 | 视图类
72 | -------------
73 | SCActionSheet-添加block回调方式
74 | SCAlertView-添加block回调方式
75 | SCButton
76 | SCDatePicker-自定义日期选择器
77 | SCLabel
78 | SCPageControl
79 | SCPickerView-自定义选择器,支持自定义数据模型绑定
80 | SCTableViewCell
81 | SCTextField
82 | SCTextView-添加了placeholder属性等
83 | SCToolbar
84 |
85 | SCScrollView
86 | - **SCBrowseView**-浏览视图,使用了重用机制,支持自动浏览
87 | - **SCCycleScrollView**-循环滚动视图,支持自动定时滚动
88 |
89 | SCTableView
90 | - **SCPullRefreshView**-刷新视图
91 | - **SCPullLoadView**-加载视图
92 |
93 | SCView
94 | - **SCActionView**-扩展视图,添加了部分动画
95 |
96 | Licenses
97 | ===========
98 |
99 | All source code is licensed.
100 |
--------------------------------------------------------------------------------
/SCFramework.podspec:
--------------------------------------------------------------------------------
1 | #
2 | # Be sure to run `pod lib lint SCFramework.podspec' to ensure this is a
3 | # valid spec and remove all comments before submitting the spec.
4 | #
5 | # Any lines starting with a # are optional, but encouraged
6 | #
7 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
8 | #
9 |
10 | Pod::Spec.new do |s|
11 | s.name = 'SCFramework'
12 | s.version = '1.1.2'
13 | s.license = 'MIT'
14 | s.summary = 'SCFramework.'
15 | s.homepage = 'https://github.com/kangchuh/SCFramework'
16 | s.author = { 'Angzn' => 'gangshuai08@gmail.com' }
17 | s.social_media_url = 'http://twitter.com/KangChuh'
18 | s.source = { :git => 'https://github.com/kangchuh/SCFramework.git', :tag => s.version.to_s }
19 | s.description = <<-DESC
20 | SCFramework.
21 | DESC
22 |
23 | s.source_files = 'SCFramework/SCFramework/SCFramework/**/*.{h,m}'
24 | s.public_header_files = 'SCFramework/SCFramework/SCFramework/**/*.h'
25 | s.resources = 'SCFramework/SCFramework/SCFramework/**/*.{lproj}'
26 | s.dependency 'FMDB', '~> 2.7.0'
27 |
28 | s.platform = :ios, '7.0'
29 | s.requires_arc = true
30 |
31 | s.library = 'z'
32 | s.ios.frameworks = 'Foundation', 'UIKit', 'CoreGraphics', 'CoreLocation', 'CoreData', 'AssetsLibrary', 'AVFoundation'
33 | end
34 |
--------------------------------------------------------------------------------
/SCFramework/Podfile:
--------------------------------------------------------------------------------
1 | source 'https://github.com/CocoaPods/Specs.git'
2 |
3 | platform :ios, '8.0'
4 |
5 | inhibit_all_warnings!
6 |
7 | target 'SCFramework' do
8 |
9 | pod 'AFNetworking', '~> 3.2.0'
10 | pod 'SDWebImage', '~> 4.4.0'
11 | pod 'Mantle', '~> 2.1.0'
12 | pod 'Masonry', '~> 1.1.0'
13 | pod 'ReactiveObjC', '~> 3.1.0'
14 |
15 | pod 'MBProgressHUD', '~> 0.9.0'
16 |
17 | pod 'FMDB', '~> 2.7.0'
18 |
19 | pod 'SSKeychain', '~> 1.2.0'
20 |
21 | end
22 |
--------------------------------------------------------------------------------
/SCFramework/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - AFNetworking (3.2.1):
3 | - AFNetworking/NSURLSession (= 3.2.1)
4 | - AFNetworking/Reachability (= 3.2.1)
5 | - AFNetworking/Security (= 3.2.1)
6 | - AFNetworking/Serialization (= 3.2.1)
7 | - AFNetworking/UIKit (= 3.2.1)
8 | - AFNetworking/NSURLSession (3.2.1):
9 | - AFNetworking/Reachability
10 | - AFNetworking/Security
11 | - AFNetworking/Serialization
12 | - AFNetworking/Reachability (3.2.1)
13 | - AFNetworking/Security (3.2.1)
14 | - AFNetworking/Serialization (3.2.1)
15 | - AFNetworking/UIKit (3.2.1):
16 | - AFNetworking/NSURLSession
17 | - FMDB (2.7.5):
18 | - FMDB/standard (= 2.7.5)
19 | - FMDB/standard (2.7.5)
20 | - Mantle (2.1.0):
21 | - Mantle/extobjc (= 2.1.0)
22 | - Mantle/extobjc (2.1.0)
23 | - Masonry (1.1.0)
24 | - MBProgressHUD (0.9.2)
25 | - ReactiveObjC (3.1.0)
26 | - SDWebImage (4.4.6):
27 | - SDWebImage/Core (= 4.4.6)
28 | - SDWebImage/Core (4.4.6)
29 | - SSKeychain (1.2.3)
30 |
31 | DEPENDENCIES:
32 | - AFNetworking (~> 3.2.0)
33 | - FMDB (~> 2.5)
34 | - Mantle (~> 2.1.0)
35 | - Masonry (~> 1.1.0)
36 | - MBProgressHUD (~> 0.9.0)
37 | - ReactiveObjC (~> 3.1.0)
38 | - SDWebImage (~> 4.4.0)
39 | - SSKeychain (~> 1.2.0)
40 |
41 | SPEC REPOS:
42 | https://github.com/cocoapods/specs.git:
43 | - AFNetworking
44 | - FMDB
45 | - Mantle
46 | - Masonry
47 | - MBProgressHUD
48 | - ReactiveObjC
49 | - SDWebImage
50 | - SSKeychain
51 |
52 | SPEC CHECKSUMS:
53 | AFNetworking: b6f891fdfaed196b46c7a83cf209e09697b94057
54 | FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
55 | Mantle: 2fa750afa478cd625a94230fbf1c13462f29395b
56 | Masonry: 678fab65091a9290e40e2832a55e7ab731aad201
57 | MBProgressHUD: 1569cf7ace17a8bac47aabfbb8580a49690386d1
58 | ReactiveObjC: 2a38ea15335de4119d8b17caf1db1484f61db902
59 | SDWebImage: 3f3f0c02f09798048c47a5ed0a13f17b063572d8
60 | SSKeychain: 3f42991739c6c60a9cf1bbd4dff6c0d3694bcf3d
61 |
62 | PODFILE CHECKSUM: 574e1d988c5b20e7ae91ea9c2f11782d7b9e6f9b
63 |
64 | COCOAPODS: 1.6.0
65 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework.xcodeproj/xcshareddata/xcschemes/SCFramework.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
39 |
40 |
41 |
42 |
43 |
44 |
54 |
56 |
62 |
63 |
64 |
65 |
66 |
67 |
73 |
75 |
81 |
82 |
83 |
84 |
86 |
87 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/4/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 | @property (strong, nonatomic) UINavigationController *navigationController;
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "29x29",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "29x29",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "40x40",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "40x40",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "60x60",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "60x60",
31 | "scale" : "3x"
32 | }
33 | ],
34 | "info" : {
35 | "version" : 1,
36 | "author" : "xcode"
37 | }
38 | }
--------------------------------------------------------------------------------
/SCFramework/SCFramework/Images.xcassets/LaunchImage.launchimage/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "orientation" : "portrait",
5 | "idiom" : "iphone",
6 | "extent" : "full-screen",
7 | "minimum-system-version" : "8.0",
8 | "subtype" : "736h",
9 | "scale" : "3x"
10 | },
11 | {
12 | "orientation" : "portrait",
13 | "idiom" : "iphone",
14 | "extent" : "full-screen",
15 | "minimum-system-version" : "8.0",
16 | "subtype" : "667h",
17 | "scale" : "2x"
18 | },
19 | {
20 | "orientation" : "portrait",
21 | "idiom" : "iphone",
22 | "extent" : "full-screen",
23 | "minimum-system-version" : "7.0",
24 | "scale" : "2x"
25 | },
26 | {
27 | "orientation" : "portrait",
28 | "idiom" : "iphone",
29 | "extent" : "full-screen",
30 | "minimum-system-version" : "7.0",
31 | "subtype" : "retina4",
32 | "scale" : "2x"
33 | }
34 | ],
35 | "info" : {
36 | "version" : 1,
37 | "author" : "xcode"
38 | }
39 | }
--------------------------------------------------------------------------------
/SCFramework/SCFramework/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys */
2 |
3 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCDemoDetailViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCDemoDetailViewController.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 5/8/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCViewController.h"
10 |
11 | @interface SCDemoDetailViewController : SCViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCDemoDetailViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // SCDemoDetailViewController.m
3 | // SCFramework
4 | //
5 | // Created by Angzn on 5/8/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCDemoDetailViewController.h"
10 |
11 | @interface SCDemoDetailViewController ()
12 |
13 | @end
14 |
15 | @implementation SCDemoDetailViewController
16 |
17 | - (void)viewDidLoad
18 | {
19 | [super viewDidLoad];
20 | // Do any additional setup after loading the view.
21 |
22 | self.view.backgroundColor = [UIColor magentaColor];
23 |
24 | UILabel *titleView = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 30.f)];
25 | titleView.backgroundColor = [UIColor clearColor];
26 | titleView.font = kSCBOLDSYSTEMFONT(18.f);
27 | titleView.text = @"列表详细页面";
28 | titleView.textAlignment = NSTextAlignmentCenter;
29 | self.navigationItem.titleView = titleView;
30 | // self.title = @"列表详细页面";
31 |
32 | ///////////////////////////// TEST /////////////////////////////
33 |
34 | UIImage *image = [UIImage imageNamed:@"TestPic.jpg"];
35 | UIImageView *imageView = [[UIImageView alloc] initWithFrame:self.view.bounds];
36 | imageView.contentMode = UIViewContentModeScaleAspectFit;
37 | //image = [image rotateCW90];
38 | //CGSize size = (CGSize){640 , 1136};
39 | //SCMathSWAP(&size.width, &size.height);
40 | //imageView.image = [image resize:size];
41 | imageView.image = [image rotate:30];
42 | [self.view addSubview:imageView];
43 | }
44 |
45 | - (void)didReceiveMemoryWarning
46 | {
47 | [super didReceiveMemoryWarning];
48 | // Dispose of any resources that can be recreated.
49 | }
50 |
51 | @end
52 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCDemoListViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCDemoListViewController.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/10/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCTableViewController.h"
10 |
11 | @interface SCDemoListViewController : SCTableViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCDemoListViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // SCDemoListViewController.m
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/10/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCDemoListViewController.h"
10 |
11 | #import "SCTableViewCell.h"
12 |
13 | #import "SCDemoDetailViewController.h"
14 |
15 | static NSInteger rows = 20;
16 |
17 | @interface SCDemoListViewController ()
18 |
19 | @end
20 |
21 | @implementation SCDemoListViewController
22 |
23 | - (void)viewDidLoad
24 | {
25 | [super viewDidLoad];
26 | // Do any additional setup after loading the view.
27 |
28 | UILabel *titleView = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 30.f)];
29 | titleView.backgroundColor = [UIColor clearColor];
30 | titleView.font = kSCBOLDSYSTEMFONT(18.f);
31 | titleView.textAlignment = NSTextAlignmentCenter;
32 | titleView.text = @"列表页面";
33 | self.navigationItem.titleView = titleView;
34 | // self.title = @"列表页面";
35 |
36 | self.tableView.refreshEnabled = YES;
37 | self.tableView.loadEnabled = YES;
38 | }
39 |
40 | - (void)viewWillAppear:(BOOL)animated
41 | {
42 | [super viewWillAppear:animated];
43 |
44 | //[self.tableView tableViewDataSourceWillStartRefresh];
45 | }
46 |
47 | - (void)viewDidAppear:(BOOL)animated
48 | {
49 | [super viewDidAppear:animated];
50 |
51 | //[self.tableView tableViewDataSourceWillStartRefresh];
52 | }
53 |
54 | - (void)didReceiveMemoryWarning
55 | {
56 | [super didReceiveMemoryWarning];
57 | // Dispose of any resources that can be recreated.
58 | }
59 |
60 | #pragma mark - UITableViewDataSource & UITableViewDelegate
61 |
62 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
63 | {
64 | return 1;
65 | }
66 |
67 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
68 | {
69 | return rows;
70 | }
71 |
72 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
73 | {
74 | SCTableViewCell *cell = (SCTableViewCell *)[super tableView:tableView cellForRowAtIndexPath:indexPath];
75 | cell.textLabel.textColor = [UIColor orangeColor];
76 | cell.textLabel.font = kSCBOLDSYSTEMFONT(18);
77 | cell.textLabel.text = [NSString stringWithFormat:@"Section is "NSI" - Row is "NSI,
78 | indexPath.section, indexPath.row];
79 | return cell;
80 | }
81 |
82 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
83 | {
84 | [tableView deselectRowAtIndexPath:indexPath animated:YES];
85 |
86 | SCDemoDetailViewController *vc = [[SCDemoDetailViewController alloc] init];
87 | [self.navigationController pushViewController:vc animated:YES];
88 | }
89 |
90 | #pragma mark - UIScrollViewDelegate
91 |
92 | - (void)scrollViewDidScroll:(UIScrollView *)scrollView
93 | {
94 | [self.tableView tableViewDidScroll:scrollView];
95 | }
96 |
97 | - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView
98 | willDecelerate:(BOOL)decelerate
99 | {
100 | [self.tableView tableViewDidEndDragging:scrollView];
101 | }
102 |
103 | #pragma mark - SCTableViewPullDelegate
104 |
105 | - (void)tableViewDidStartRefresh:(SCTableView *)tableView
106 | {
107 | double delayInSeconds = 2.0;
108 | dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
109 | dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
110 | [tableView tableViewDataSourceDidFinishedRefresh];
111 |
112 | rows = 20;
113 |
114 | [self.tableView reloadData];
115 | });
116 | }
117 |
118 | - (void)tableViewDidStartLoadMore:(SCTableView *)tableView
119 | {
120 | double delayInSeconds = 2.0;
121 | dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
122 | dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
123 | [tableView tableViewDataSourceDidFinishedLoadMore];
124 |
125 | rows += 20;
126 |
127 | [self.tableView reloadData];
128 | });
129 | }
130 |
131 | @end
132 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | ${PRODUCT_NAME}
9 | CFBundleExecutable
10 | ${EXECUTABLE_NAME}
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | ${PRODUCT_NAME}
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | 1.0
25 | LSRequiresIPhoneOS
26 |
27 | NSLocationAlwaysUsageDescription
28 | 允许始终访问您的位置
29 | NSLocationWhenInUseUsageDescription
30 | 允许使用期间访问您的位置
31 | UIRequiredDeviceCapabilities
32 |
33 | armv7
34 |
35 | UISupportedInterfaceOrientations
36 |
37 | UIInterfaceOrientationPortrait
38 | UIInterfaceOrientationLandscapeLeft
39 | UIInterfaceOrientationLandscapeRight
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework-Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // Prefix header
3 | //
4 | // The contents of this file are implicitly included at the beginning of every source file.
5 | //
6 |
7 | #ifdef __OBJC__
8 | #import
9 | #import
10 | #import
11 | #import
12 |
13 | #import "SCFramework.h"
14 | #endif
15 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Adapted/AdaptedDevice/SCAdaptedDevice.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCAdaptedDevice.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/5/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface SCAdaptedDevice : NSObject
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Adapted/AdaptedDevice/SCAdaptedDevice.m:
--------------------------------------------------------------------------------
1 | //
2 | // SCAdaptedDevice.m
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/5/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCAdaptedDevice.h"
10 |
11 | @implementation SCAdaptedDevice
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Adapted/AdaptedSystem/SCAdaptedSystem.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCAdaptedSystem.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 5/4/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | /**
12 | * @brief 检查是否iOS7+
13 | */
14 | extern BOOL SCiOS7OrLater(void);
15 |
16 | /**
17 | * @brief 检查是否iOS8+
18 | */
19 | extern BOOL SCiOS8OrLater(void);
20 |
21 | /**
22 | * @brief 获取适配的坐标(此坐标是基于iOS7+的坐标系)
23 | */
24 | CG_EXTERN CGRect CGRectAdapt(CGFloat x,
25 | CGFloat y,
26 | CGFloat width,
27 | CGFloat height,
28 | BOOL adaptedStatusBar,
29 | BOOL adaptedNavBar,
30 | BOOL adjustHeight);
31 |
32 | @interface SCAdaptedSystem : NSObject
33 |
34 | @end
35 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Adapted/AdaptedSystem/SCAdaptedSystem.m:
--------------------------------------------------------------------------------
1 | //
2 | // SCAdaptedSystem.m
3 | // SCFramework
4 | //
5 | // Created by Angzn on 5/4/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCAdaptedSystem.h"
10 | #import "SCConstant.h"
11 | #import "SCLog.h"
12 |
13 | /**
14 | * @brief 检查是否iOS7+
15 | */
16 | BOOL SCiOS7OrLater(void)
17 | {
18 | static BOOL iOS7OrLater;
19 | static dispatch_once_t onceToken;
20 | dispatch_once(&onceToken, ^{
21 | #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000
22 | CGFloat systemVersion = [[[UIDevice currentDevice] systemVersion]
23 | doubleValue];
24 | if (systemVersion >= 7.f) {
25 | iOS7OrLater = YES;
26 | } else {
27 | iOS7OrLater = NO;
28 | }
29 | #else
30 | iOS7OrLater = NO;
31 | #endif
32 | });
33 | //DLog(@"%@%@", @"iOS 7 Or Later : ", iOS7OrLater ? @"YES" : @"NO");
34 | return iOS7OrLater;
35 | }
36 |
37 | /**
38 | * @brief 检查是否iOS8+
39 | */
40 | extern BOOL SCiOS8OrLater(void)
41 | {
42 | static BOOL iOS8OrLater;
43 | static dispatch_once_t onceToken;
44 | dispatch_once(&onceToken, ^{
45 | #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
46 | CGFloat systemVersion = [[[UIDevice currentDevice] systemVersion]
47 | doubleValue];
48 | if (systemVersion >= 8.f) {
49 | iOS8OrLater = YES;
50 | } else {
51 | iOS8OrLater = NO;
52 | }
53 | #else
54 | iOS8OrLater = NO;
55 | #endif
56 | });
57 | //DLog(@"%@%@", @"iOS 8 Or Later : ", iOS8OrLater ? @"YES" : @"NO");
58 | return iOS8OrLater;
59 | }
60 |
61 | /**
62 | * @brief 获取适配的坐标(此坐标是基于iOS7+的坐标系)
63 | *
64 | * @param x x 坐标
65 | * @param y y 坐标
66 | * @param width 宽度
67 | * @param height 高度
68 | * @param adaptedStatusBar 是否适配状态栏(YES, 高度在Y坐标计算范围内; 反之)
69 | * @param adaptedNavBar 是否适配导航栏(YES, 高度在Y坐标计算范围内; 反之)
70 | * @param adjustHeight 是否自适应高度
71 | *
72 | * @return 适配的坐标
73 | */
74 | CGRect CGRectAdapt(CGFloat x,
75 | CGFloat y,
76 | CGFloat width,
77 | CGFloat height,
78 | BOOL adaptedStatusBar,
79 | BOOL adaptedNavBar,
80 | BOOL adjustHeight)
81 | {
82 | BOOL iOS7OrLater = SCiOS7OrLater();
83 |
84 | CGRect rect;
85 | rect.origin.x = x;
86 | rect.size.width = width;
87 | if (iOS7OrLater) {
88 | rect.origin.y = y;
89 | rect.size.height = height;
90 | } else {
91 | if (adaptedStatusBar && !adaptedNavBar) {
92 | rect.origin.y = y - kSCFW_STATUSBAR_HEIGHT;
93 | } else if (adaptedStatusBar && adaptedNavBar) {
94 | rect.origin.y = y - (kSCFW_STATUSBAR_HEIGHT +
95 | kSCFW_NAVIGATIONBAR_HEIGHT);
96 | } else {
97 | rect.origin.y = y;
98 | }
99 | if (adjustHeight && adaptedStatusBar && !adaptedNavBar) {
100 | rect.size.height = height + kSCFW_STATUSBAR_HEIGHT;
101 | } else if (adjustHeight && adaptedStatusBar && adaptedNavBar) {
102 | rect.size.height = height + (kSCFW_STATUSBAR_HEIGHT +
103 | kSCFW_NAVIGATIONBAR_HEIGHT);
104 | } else {
105 | rect.size.height = height;
106 | }
107 | }
108 | return rect;
109 | }
110 |
111 | @implementation SCAdaptedSystem
112 |
113 | @end
114 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Category/NSArray+SCAddition.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSArray+SCAddition.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/5/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface NSArray (SCAddition)
12 |
13 | - (BOOL)isNotEmpty;
14 |
15 | @end
16 |
17 |
18 | @interface NSMutableArray(SCAddition)
19 |
20 | + (NSMutableArray *)arrayWithCapacity:(NSUInteger)capacity
21 | withObject:(id)theObject;
22 |
23 | - (void)replaceAllObjectsWithObject:(id)theObject;
24 | - (void)replaceAllObjectsWithNULL;
25 |
26 | @end
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Category/NSArray+SCAddition.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSArray+SCAddition.m
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/5/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "NSArray+SCAddition.h"
10 |
11 | @implementation NSArray (SCAddition)
12 |
13 | /**
14 | * @brief 判断是否为空
15 | */
16 | - (BOOL)isNotEmpty
17 | {
18 | return (![(NSNull *)self isEqual:[NSNull null]]
19 | && [self isKindOfClass:[NSArray class]]
20 | && self.count > 0);
21 | }
22 |
23 | @end
24 |
25 |
26 | @implementation NSMutableArray(SCAddition)
27 |
28 | + (NSMutableArray *)arrayWithCapacity:(NSUInteger)capacity
29 | withObject:(id)theObject
30 | {
31 | NSMutableArray *array = [NSMutableArray arrayWithCapacity:capacity];
32 | for (int i = 0; i < capacity; ++i) {
33 | [array addObject:theObject];
34 | }
35 | return array;
36 | }
37 |
38 | - (void)replaceAllObjectsWithObject:(id)theObject
39 | {
40 | if (!self.isNotEmpty) {
41 | return;
42 | }
43 | if (!theObject) {
44 | return;
45 | }
46 | for (int i = 0; i < [self count]; ++i) {
47 | [self replaceObjectAtIndex:i withObject:theObject];
48 | }
49 | }
50 |
51 | - (void)replaceAllObjectsWithNULL
52 | {
53 | [self replaceAllObjectsWithObject:[NSNull null]];
54 | }
55 |
56 | @end
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Category/NSAttributedString+SCAddition.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSAttributedString+SCAddition.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 16/5/9.
6 | // Copyright © 2016年 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface NSAttributedString (SCAddition)
12 |
13 | - (CGFloat)heightForConstrainedToWidth:(CGFloat)width;
14 | - (CGFloat)widthForConstrainedToHeight:(CGFloat)height;
15 |
16 | - (CGSize)sizeForConstrainedToWidth:(CGFloat)width;
17 | - (CGSize)sizeForConstrainedToHeight:(CGFloat)height;
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Category/NSAttributedString+SCAddition.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSAttributedString+SCAddition.m
3 | // SCFramework
4 | //
5 | // Created by Angzn on 16/5/9.
6 | // Copyright © 2016年 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "NSAttributedString+SCAddition.h"
10 |
11 | @implementation NSAttributedString (SCAddition)
12 |
13 | - (CGFloat)heightForConstrainedToWidth:(CGFloat)width
14 | {
15 | return [self sizeForConstrainedToWidth:width].height;
16 | }
17 |
18 | - (CGFloat)widthForConstrainedToHeight:(CGFloat)height
19 | {
20 | return [self sizeForConstrainedToHeight:height].width;
21 | }
22 |
23 | - (CGSize)sizeForConstrainedToWidth:(CGFloat)width
24 | {
25 | CGSize textSize = [self boundingRectWithSize:CGSizeMake(width, CGFLOAT_MAX)
26 | options:(NSStringDrawingUsesLineFragmentOrigin |
27 | NSStringDrawingTruncatesLastVisibleLine)
28 | context:nil].size;
29 | return CGSizeMake(ceil(textSize.width), ceil(textSize.height));
30 | }
31 |
32 | - (CGSize)sizeForConstrainedToHeight:(CGFloat)height
33 | {
34 | CGSize textSize = [self boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, height)
35 | options:(NSStringDrawingUsesLineFragmentOrigin |
36 | NSStringDrawingTruncatesLastVisibleLine)
37 | context:nil].size;
38 | return CGSizeMake(ceil(textSize.width), ceil(textSize.height));
39 | }
40 |
41 | @end
42 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Category/NSData+SCAddition.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSData+SCAddition.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/5/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface NSData (SCAddition)
12 |
13 | - (BOOL)isNotEmpty;
14 |
15 | /// 获取图片ContentType
16 | - (NSString *)contentType;
17 |
18 | /// 是否包含前缀
19 | - (BOOL)hasPrefixBytes:(const void *)prefix length:(NSUInteger)length;
20 |
21 | /// 是否包含后缀
22 | - (BOOL)hasSuffixBytes:(const void *)suffix length:(NSUInteger)length;
23 |
24 | #pragma mark - GZIP
25 |
26 | /// GZIP压缩
27 | - (NSData *)gzippedDataWithCompressionLevel:(float)level;
28 |
29 | /// GZIP压缩
30 | - (NSData *)gzippedData;
31 |
32 | /// GZIP解压
33 | - (NSData *)gunzippedData;
34 |
35 | @end
36 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Category/NSDate+SCAddition.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSDate+SCAddition.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/5/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #define kSCFW_SECOND_MINUTE 60
12 | #define kSCFW_SECOND_HOUR 3600
13 | #define kSCFW_SECOND_DAY 86400
14 | #define kSCFW_SECOND_WEEK 604800
15 | #define kSCFW_SECOND_YEAR 31556926
16 |
17 | @interface NSDate (SCAddition)
18 |
19 | /// 时间戳
20 | - (NSTimeInterval)timestamp;
21 |
22 | - (NSInteger)year;
23 | - (NSInteger)month;
24 | - (NSInteger)day;
25 | - (NSInteger)hour;
26 | - (NSInteger)minute;
27 | - (NSInteger)second;
28 |
29 | #if __IPHONE_OS_VERSION_MIN_REQUIRED < 70000
30 | - (NSInteger)week
31 | #else
32 | - (NSInteger)weekOfMonth;
33 | - (NSInteger)weekOfYear;
34 | #endif
35 |
36 | /// 获取月份的天数
37 | - (NSInteger)numberOfDaysInMonth;
38 |
39 | /// 判断是否闰年
40 | - (BOOL)isLeapYear;
41 |
42 | /// 时间转字符串
43 | - (NSString *)stringWithFormat:(NSString *)format;
44 |
45 | /// 一天的开始时间
46 | - (NSDate *)beginOfDay;
47 | /// 一天的结束时间
48 | - (NSDate *)endOfDay;
49 |
50 | /// 是否是同一天
51 | - (BOOL)isSameDay:(NSDate *)anotherDate;
52 |
53 | /// 是否是今天
54 | - (BOOL)isToday;
55 |
56 | /// 日期相隔多少天
57 | - (NSInteger)daysSinceDate:(NSDate *)anotherDate;
58 |
59 | @end
60 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Category/NSDictionary+SCAddition.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSDictionary+SCAddition.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/5/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface NSDictionary (SCAddition)
12 |
13 | - (BOOL)isNotEmpty;
14 |
15 | - (NSArray *)arrayForKey:(id)aKey;
16 | - (NSDictionary *)dictionaryForKey:(id)aKey;
17 |
18 | - (NSString *)stringForKey:(id)aKey;
19 | - (NSInteger)integerForKey:(id)aKey;
20 | - (int)intForKey:(id)aKey;
21 | - (float)floatForKey:(id)aKey;
22 | - (double)doubleForKey:(id)aKey;
23 | - (BOOL)boolForKey:(id)aKey;
24 |
25 | - (NSArray *)sc_arrayForKey:(id)aKey;
26 | - (NSDictionary *)sc_dictionaryForKey:(id)aKey;
27 |
28 | - (NSString *)sc_stringForKey:(id)aKey;
29 | - (NSInteger)sc_integerForKey:(id)aKey;
30 | - (int)sc_intForKey:(id)aKey;
31 | - (float)sc_floatForKey:(id)aKey;
32 | - (double)sc_doubleForKey:(id)aKey;
33 | - (BOOL)sc_boolForKey:(id)aKey;
34 |
35 | - (NSString *)paramString;
36 |
37 | @end
38 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Category/NSObject+SCAddition.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSObject+SCAddition.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/28/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | extern NSString * const SCObjcTypeChar;
12 | extern NSString * const SCObjcTypeInt;
13 | extern NSString * const SCObjcTypeShort;
14 | extern NSString * const SCObjcTypeInt32;
15 | extern NSString * const SCObjcTypeInt64;
16 |
17 | extern NSString * const SCObjcTypeUChar;
18 | extern NSString * const SCObjcTypeUInt;
19 | extern NSString * const SCObjcTypeUShort;
20 | extern NSString * const SCObjcTypeUInt32;
21 | extern NSString * const SCObjcTypeUInt64;
22 |
23 | extern NSString * const SCObjcTypeFloat;
24 | extern NSString * const SCObjcTypeDouble;
25 |
26 | extern NSString * const SCObjcTypeBool;
27 |
28 | extern NSString * const SCObjcTypeCGPoint;
29 | extern NSString * const SCObjcTypeCGSize;
30 | extern NSString * const SCObjcTypeCGRect;
31 |
32 | extern NSString * const SCObjcTypeNSNumber;
33 | extern NSString * const SCObjcTypeNSValue;
34 |
35 | extern NSString * const SCObjcTypeNSDate;
36 |
37 | extern NSString * const SCObjcTypeNSData;
38 | extern NSString * const SCObjcTypeUIImage;
39 |
40 | extern NSString * const SCObjcTypeNSString;
41 |
42 | @interface NSObject (SCAddition)
43 |
44 | + (NSDictionary *)codableProperties;
45 | - (NSDictionary *)codableProperties;
46 |
47 | + (NSDictionary *)storableProperties;
48 | - (NSDictionary *)storableProperties;
49 |
50 | @end
51 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Category/NSString+SCAddition.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSString+SCAddition.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/5/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface NSString (SCAddition)
12 |
13 | - (BOOL)isNotEmpty;
14 |
15 | - (NSString *)trimWhitespaceAndNewline;
16 |
17 | - (BOOL)containsCharacterSet:(NSCharacterSet *)set;
18 |
19 | - (BOOL)containsString:(NSString *)string;
20 |
21 | - (int)wordsCount;
22 |
23 | - (NSString *)URLEncodedString;
24 | - (NSString *)URLDecodedString;
25 |
26 | - (NSURL *)URL;
27 | - (NSURL *)fileURL;
28 |
29 | - (NSString *)MD5String;
30 |
31 | - (BOOL)isNumber;
32 | - (BOOL)isEnglishWords;
33 | - (BOOL)isChineseWords;
34 |
35 | - (BOOL)isEmail;
36 | - (BOOL)isURL;
37 | - (BOOL)isPhoneNumber;
38 | - (BOOL)isMobilePhoneNumber;
39 | - (BOOL)isIdentifyCardNumber;
40 | - (BOOL)isOrganizationCode;
41 |
42 | - (BOOL)isValidPassword;
43 | - (BOOL)isValidName;
44 |
45 | - (NSDate *)dateWithFormat:(NSString *)format;
46 |
47 | - (NSDictionary *)paramValue;
48 |
49 | - (CGFloat)heightWithFont:(UIFont *)font constrainedToWidth:(CGFloat)width;
50 | - (CGFloat)widthWithFont:(UIFont *)font constrainedToHeight:(CGFloat)height;
51 |
52 | - (CGSize)sizeWithFont:(UIFont *)font constrainedToWidth:(CGFloat)width;
53 | - (CGSize)sizeWithFont:(UIFont *)font constrainedToHeight:(CGFloat)height;
54 |
55 | @end
56 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Category/NSTimer+SCAddition.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSTimer+SCAddition.h
3 | // ZhongTouBang
4 | //
5 | // Created by Angzn on 8/20/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface NSTimer (SCAddition)
12 |
13 | - (void)pause;
14 | - (void)resume;
15 | - (void)resumeAfterTimeInterval:(NSTimeInterval)interval;
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Category/NSTimer+SCAddition.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSTimer+SCAddition.m
3 | // ZhongTouBang
4 | //
5 | // Created by Angzn on 8/20/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "NSTimer+SCAddition.h"
10 |
11 | @implementation NSTimer (SCAddition)
12 |
13 | - (void)pause
14 | {
15 | if (![self isValid]) {
16 | return ;
17 | }
18 | [self setFireDate:[NSDate distantFuture]];
19 | }
20 |
21 | - (void)resume
22 | {
23 | if (![self isValid]) {
24 | return ;
25 | }
26 | [self setFireDate:[NSDate date]];
27 | }
28 |
29 | - (void)resumeAfterTimeInterval:(NSTimeInterval)interval
30 | {
31 | if (![self isValid]) {
32 | return ;
33 | }
34 | [self setFireDate:[NSDate dateWithTimeIntervalSinceNow:interval]];
35 | }
36 |
37 | @end
38 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Category/NSURL+SCAddition.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSURL+SCAddition.h
3 | // ZhongTouBang
4 | //
5 | // Created by Angzn on 6/11/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface NSURL (SCAddition)
12 |
13 | /**
14 | * URL连接参数
15 | */
16 | - (NSURL *)serializeParams:(NSDictionary *)params;
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Category/NSURL+SCAddition.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSURL+SCAddition.m
3 | // ZhongTouBang
4 | //
5 | // Created by Angzn on 6/11/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "NSURL+SCAddition.h"
10 | #import "NSString+SCAddition.h"
11 | #import "NSDictionary+SCAddition.h"
12 |
13 | @implementation NSURL (SCAddition)
14 |
15 | - (NSURL *)serializeParams:(NSDictionary *)params
16 | {
17 | NSString *baseURLString = [self absoluteString];
18 | NSString *queryPrefix = [[self query] isNotEmpty] ? @"&" : @"?";
19 | NSString *query = [params paramString];
20 | NSString *URLString = [NSString stringWithFormat:@"%@%@%@",
21 | baseURLString, queryPrefix, query];
22 | return [NSURL URLWithString:URLString];
23 | }
24 |
25 | @end
26 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Category/UIAlertView+SCAddition.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIAlertView+SCAddition.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/5/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface UIAlertView (SCAddition)
12 |
13 | + (void)showWithMessage:(NSString *)message;
14 | + (void)showWithTitle:(NSString *)title
15 | message:(NSString *)message;
16 | + (void)showWithTitle:(NSString *)title
17 | message:(NSString *)message
18 | delegate:(id)delegate;
19 | + (void)showWithTitle:(NSString *)title
20 | message:(NSString *)message
21 | delegate:(id)delegate
22 | cancelButtonTitle:(NSString *)cancelButtonTitle
23 | otherButtonTitle:(NSString *)otherButtonTitle;
24 | + (void)showWithTitle:(NSString *)title
25 | message:(NSString *)message
26 | delegate:(id)delegate
27 | cancelButtonTitle:(NSString *)cancelButtonTitle
28 | otherButtonTitle:(NSString *)otherButtonTitle
29 | tag:(NSInteger)tag;
30 |
31 | @end
32 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Category/UIAlertView+SCAddition.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIAlertView+SCAddition.m
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/5/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "UIAlertView+SCAddition.h"
10 |
11 | @implementation UIAlertView (SCAddition)
12 |
13 | + (void)showWithMessage:(NSString *)message
14 | {
15 | NSString *cancelTitle = NSLocalizedStringFromTable(@"SCFW_LS_OK", @"SCFWLocalizable", nil);
16 | UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@""
17 | message:message
18 | delegate:nil
19 | cancelButtonTitle:cancelTitle
20 | otherButtonTitles:nil];
21 | [alert show];
22 | #if ! __has_feature(objc_arc)
23 | [alert release];
24 | #endif
25 | }
26 |
27 | + (void)showWithTitle:(NSString *)title
28 | message:(NSString *)message
29 | {
30 | NSString *cancelTitle = NSLocalizedStringFromTable(@"SCFW_LS_OK", @"SCFWLocalizable", nil);
31 | UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title
32 | message:message
33 | delegate:nil
34 | cancelButtonTitle:cancelTitle
35 | otherButtonTitles:nil];
36 | [alert show];
37 | #if ! __has_feature(objc_arc)
38 | [alert release];
39 | #endif
40 | }
41 |
42 | + (void)showWithTitle:(NSString *)title
43 | message:(NSString *)message
44 | delegate:(id /**/)delegate
45 | {
46 | NSString *cancelTitle = NSLocalizedStringFromTable(@"SCFW_LS_OK", @"SCFWLocalizable", nil);
47 | UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title
48 | message:message
49 | delegate:delegate
50 | cancelButtonTitle:cancelTitle
51 | otherButtonTitles:nil];
52 | [alert show];
53 | #if ! __has_feature(objc_arc)
54 | [alert release];
55 | #endif
56 | }
57 |
58 | + (void)showWithTitle:(NSString *)title
59 | message:(NSString *)message
60 | delegate:(id /**/)delegate
61 | cancelButtonTitle:(NSString *)cancelButtonTitle
62 | otherButtonTitle:(NSString *)otherButtonTitle
63 | {
64 | UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title
65 | message:message
66 | delegate:delegate
67 | cancelButtonTitle:cancelButtonTitle
68 | otherButtonTitles:otherButtonTitle, nil];
69 | [alert show];
70 | #if ! __has_feature(objc_arc)
71 | [alert release];
72 | #endif
73 | }
74 |
75 | + (void)showWithTitle:(NSString *)title
76 | message:(NSString *)message
77 | delegate:(id /**/)delegate
78 | cancelButtonTitle:(NSString *)cancelButtonTitle
79 | otherButtonTitle:(NSString *)otherButtonTitle
80 | tag:(NSInteger)tag
81 | {
82 | UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title
83 | message:message
84 | delegate:delegate
85 | cancelButtonTitle:cancelButtonTitle
86 | otherButtonTitles:otherButtonTitle, nil];
87 | [alert setTag:tag];
88 | [alert show];
89 | #if ! __has_feature(objc_arc)
90 | [alert release];
91 | #endif
92 | }
93 |
94 | @end
95 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Category/UIBarButtonItem+SCAddition.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIBarButtonItem+SCAddition.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 9/23/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface UIBarButtonItem (SCAddition)
12 |
13 | - (instancetype)initWithTarget:(id)target action:(SEL)action;
14 | - (instancetype)initWithBarButtonSystemItem:(UIBarButtonSystemItem)systemItem;
15 | - (instancetype)initWithFixedSpaceWidth:(CGFloat)spaceWidth;
16 | + (instancetype)flexibleSpaceSystemItem;
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Category/UIBarButtonItem+SCAddition.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIBarButtonItem+SCAddition.m
3 | // SCFramework
4 | //
5 | // Created by Angzn on 9/23/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "UIBarButtonItem+SCAddition.h"
10 |
11 | @implementation UIBarButtonItem (SCAddition)
12 |
13 | - (instancetype)initWithTarget:(id)target action:(SEL)action
14 | {
15 | self = [self initWithTitle:nil style:UIBarButtonItemStylePlain target:target action:action];
16 | if (self) {
17 | // Initialization code
18 | }
19 | return self;
20 | }
21 |
22 | - (instancetype)initWithBarButtonSystemItem:(UIBarButtonSystemItem)systemItem
23 | {
24 | self = [self initWithBarButtonSystemItem:systemItem target:nil action:nil];
25 | if (self) {
26 | // Initialization code
27 | }
28 | return self;
29 | }
30 |
31 | - (instancetype)initWithFixedSpaceWidth:(CGFloat)spaceWidth
32 | {
33 | self = [self initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace];
34 | if (self) {
35 | // Initialization code
36 | self.width = spaceWidth;
37 | }
38 | return self;
39 | }
40 |
41 | + (instancetype)flexibleSpaceSystemItem
42 | {
43 | return [[self alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace];
44 | }
45 |
46 | @end
47 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Category/UIColor+SCAddition.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIColor+SCAddition.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/5/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface UIColor (SCAddition)
12 |
13 | + (UIColor *)colorWithWholeRed:(CGFloat)red
14 | green:(CGFloat)green
15 | blue:(CGFloat)blue
16 | alpha:(CGFloat)alpha;
17 |
18 | + (UIColor *)colorWithWholeRed:(CGFloat)red
19 | green:(CGFloat)green
20 | blue:(CGFloat)blue;
21 |
22 | + (UIColor *)colorWithHex:(NSInteger)hexColor
23 | alpha:(CGFloat)alpha;
24 |
25 | + (UIColor *)colorWithHex:(NSInteger)hexColor;
26 |
27 | - (NSArray *)RGBComponents;
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Category/UIColor+SCAddition.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIColor+SCAddition.m
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/5/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "UIColor+SCAddition.h"
10 |
11 | @implementation UIColor (SCAddition)
12 |
13 | + (UIColor *)colorWithWholeRed:(CGFloat)red
14 | green:(CGFloat)green
15 | blue:(CGFloat)blue
16 | alpha:(CGFloat)alpha
17 | {
18 | return [UIColor colorWithRed:red/255.f
19 | green:green/255.f
20 | blue:blue/255.f
21 | alpha:alpha];
22 | }
23 |
24 | + (UIColor *)colorWithWholeRed:(CGFloat)red
25 | green:(CGFloat)green
26 | blue:(CGFloat)blue
27 | {
28 | return [self colorWithWholeRed:red
29 | green:green
30 | blue:blue
31 | alpha:1.0];
32 | }
33 |
34 | + (UIColor *)colorWithHex:(NSInteger)hexColor
35 | alpha:(CGFloat)alpha
36 | {
37 | return [UIColor colorWithRed:((float) ((hexColor & 0xFF0000) >> 16)) / 0xFF
38 | green:((float) ((hexColor & 0xFF00) >> 8)) / 0xFF
39 | blue:((float) (hexColor & 0xFF)) / 0xFF
40 | alpha:alpha];
41 | }
42 |
43 | + (UIColor *)colorWithHex:(NSInteger)hexColor
44 | {
45 | return [self colorWithHex:hexColor alpha:1.0];
46 | }
47 |
48 | - (NSArray *)RGBComponents
49 | {
50 | CGColorRef colorRef = [self CGColor];
51 | size_t colorComponents = CGColorGetNumberOfComponents(colorRef);
52 | if (colorComponents == 4) {
53 | int rValue, gValue, bValue;
54 | const CGFloat *components = CGColorGetComponents(colorRef);
55 | rValue = (int)(components[0] * 255.0f);
56 | gValue = (int)(components[1] * 255.0f);
57 | bValue = (int)(components[2] * 255.0f);
58 | return [NSArray arrayWithObjects:
59 | [NSNumber numberWithInt:rValue],
60 | [NSNumber numberWithInt:gValue],
61 | [NSNumber numberWithInt:bValue], nil];
62 | }
63 | return nil;
64 | }
65 |
66 | @end
67 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Category/UIDevice+SCAddition.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIDevice+SCAddition.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/6/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface UIDevice (SCAddition)
12 |
13 | /// 获取设备型号
14 | + (NSString *)deviceVersion;
15 |
16 | /// 获取iOS系统的版本号
17 | + (NSString *)systemVersion;
18 |
19 | /// 判断当前设备是否iPad
20 | + (BOOL)iPad;
21 |
22 | /// 判断当前设备是否iPhone
23 | + (BOOL)iPhone;
24 |
25 | /// 竖屏
26 | + (BOOL)portrait;
27 |
28 | /// 横屏
29 | + (BOOL)landscape;
30 |
31 | /// 判断当前系统是否有摄像头
32 | + (BOOL)hasCamera;
33 |
34 | /// 获取用户语言
35 | + (NSString *)preferredLanguages;
36 |
37 | /// 平台信息
38 | + (NSString *)platform;
39 |
40 | /// 设备型号
41 | + (NSString *)deviceModel;
42 |
43 | /// 获取手机内存总量, 返回的是字节数
44 | + (NSUInteger)totalMemoryBytes;
45 | /// 获取手机可用内存, 返回的是字节数
46 | + (NSUInteger)freeMemoryBytes;
47 |
48 | /// 获取手机硬盘空闲空间, 返回的是字节数
49 | + (long long)freeDiskSpaceBytes;
50 | /// 获取手机硬盘总空间, 返回的是字节数
51 | + (long long)totalDiskSpaceBytes;
52 |
53 | @end
54 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Category/UIImage+SCAddition.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIImage+SCAddition.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/5/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface UIImage (SCAddition)
12 |
13 | - (UIImage *)fixOrientation;
14 |
15 | - (UIImage *)transparent;
16 |
17 | - (UIImage *)resize:(CGSize)newSize;
18 |
19 | - (UIImage *)scaleTo:(CGSize)size;
20 | - (UIImage *)scaleDown:(CGSize)maxSize;
21 |
22 | - (UIImage *)stretched;
23 | - (UIImage *)stretched:(UIEdgeInsets)capInsets;
24 |
25 | - (UIImage *)rotate:(CGFloat)angle;
26 | - (UIImage *)rotateCW90;
27 | - (UIImage *)rotateCW180;
28 | - (UIImage *)rotateCW270;
29 |
30 | - (UIImage *)crop:(CGRect)rect;
31 | - (UIImage *)cropSquare;
32 |
33 | - (UIImage *)merge:(UIImage *)image;
34 | + (UIImage *)merge:(NSArray *)images;
35 |
36 | - (NSData *)dataWithExt:(NSString *)ext;
37 |
38 | - (UIColor *)patternColor;
39 |
40 | - (CGFloat)width;
41 | - (CGFloat)height;
42 |
43 | + (UIImage *)imageWithColor:(UIColor *)color;
44 |
45 | @end
46 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Category/UINavigationController+SCAddition.h:
--------------------------------------------------------------------------------
1 | //
2 | // UINavigationController+SCAddition.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 5/8/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface UINavigationController (SCAddition)
12 |
13 | - (BOOL)isOnlyContainRootViewController;
14 | - (UIViewController *)rootViewController;
15 |
16 | - (NSArray *)popToViewControllerWithClass:(Class)viewControllerClass animated:(BOOL)animated;
17 | - (NSArray *)popToViewControllerWithLevel:(NSInteger)level animated:(BOOL)animated;
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Category/UINavigationController+SCAddition.m:
--------------------------------------------------------------------------------
1 | //
2 | // UINavigationController+SCAddition.m
3 | // SCFramework
4 | //
5 | // Created by Angzn on 5/8/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "UINavigationController+SCAddition.h"
10 | #import "NSArray+SCAddition.h"
11 |
12 | @implementation UINavigationController (SCAddition)
13 |
14 | - (BOOL)isOnlyContainRootViewController
15 | {
16 | if (self.viewControllers.isNotEmpty &&
17 | self.viewControllers.count == 1) {
18 | return YES;
19 | }
20 | return NO;
21 | }
22 |
23 | - (UIViewController *)rootViewController
24 | {
25 | if (self.viewControllers.isNotEmpty) {
26 | return [self.viewControllers firstObject];
27 | }
28 | return nil;
29 | }
30 |
31 | - (NSArray *)popToViewControllerWithClass:(Class)viewControllerClass animated:(BOOL)animated
32 | {
33 | NSInteger viewControllersCount = self.viewControllers.count;
34 | for (NSInteger i = viewControllersCount - 1; i >= 0; --i) {
35 | UIViewController *viewController = self.viewControllers[i];
36 | if ([viewController isKindOfClass:viewControllerClass]) {
37 | return [self popToViewController:viewController animated:animated];
38 | }
39 | }
40 | return nil;
41 | }
42 |
43 | - (NSArray *)popToViewControllerWithLevel:(NSInteger)level animated:(BOOL)animated
44 | {
45 | NSInteger viewControllersCount = self.viewControllers.count;
46 | if (viewControllersCount > level) {
47 | NSInteger idx = viewControllersCount - level - 1;
48 | UIViewController *viewController = self.viewControllers[idx];
49 | return [self popToViewController:viewController animated:animated];
50 | } else {
51 | return [self popToRootViewControllerAnimated:animated];
52 | }
53 | }
54 |
55 | @end
56 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Category/UINavigationItem+SCAddition.h:
--------------------------------------------------------------------------------
1 | //
2 | // UINavigationItem+SCAddition.h
3 | // ZhongTouBang
4 | //
5 | // Created by Angzn on 7/1/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface UINavigationItem (SCAddition)
12 |
13 | - (void)lockRightItem:(BOOL)lock;
14 | - (void)lockLeftItem:(BOOL)lock;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Category/UINavigationItem+SCAddition.m:
--------------------------------------------------------------------------------
1 | //
2 | // UINavigationItem+SCAddition.m
3 | // ZhongTouBang
4 | //
5 | // Created by Angzn on 7/1/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "UINavigationItem+SCAddition.h"
10 | #import "NSArray+SCAddition.h"
11 |
12 | @implementation UINavigationItem (SCAddition)
13 |
14 | - (void)lockRightItem:(BOOL)lock
15 | {
16 | NSArray *rightBarItems = self.rightBarButtonItems;
17 | if ([rightBarItems isNotEmpty]) {
18 | [rightBarItems enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
19 | if ([obj isKindOfClass:[UIBarButtonItem class]] ||
20 | [obj isMemberOfClass:[UIBarButtonItem class]])
21 | {
22 | UIBarButtonItem *barButtonItem = (UIBarButtonItem *)obj;
23 | barButtonItem.enabled = !lock;
24 | }
25 | }];
26 | }
27 | }
28 |
29 | - (void)lockLeftItem:(BOOL)lock
30 | {
31 | NSArray *leftBarItems = self.leftBarButtonItems;
32 | if ([leftBarItems isNotEmpty]) {
33 | [leftBarItems enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
34 | if ([obj isKindOfClass:[UIBarButtonItem class]] ||
35 | [obj isMemberOfClass:[UIBarButtonItem class]])
36 | {
37 | UIBarButtonItem *barButtonItem = (UIBarButtonItem *)obj;
38 | barButtonItem.enabled = !lock;
39 | }
40 | }];
41 | }
42 | }
43 |
44 |
45 | @end
46 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Category/UIScreen+SCAddition.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIScreen+SCAddition.h
3 | // ZhongTouBang
4 | //
5 | // Created by Angzn on 7/16/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface UIScreen (SCAddition)
12 |
13 | + (CGSize)size;
14 | + (CGFloat)width;
15 | + (CGFloat)height;
16 | + (CGSize)orientationSize;
17 | + (CGFloat)orientationWidth;
18 | + (CGFloat)orientationHeight;
19 | + (BOOL)isFivePointEightInch;
20 | + (BOOL)isFivePointFiveInch;
21 | + (BOOL)isFourPointSevenInch;
22 | + (BOOL)isFourInch;
23 | + (BOOL)isThreePointFiveInch;
24 | + (CGSize)DPISize;
25 |
26 | @end
27 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Category/UIScreen+SCAddition.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIScreen+SCAddition.m
3 | // ZhongTouBang
4 | //
5 | // Created by Angzn on 7/16/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "UIScreen+SCAddition.h"
10 | #import "UIDevice+SCAddition.h"
11 | #import "SCAdaptedSystem.h"
12 | #import "SCMath.h"
13 | #import "SCApp.h"
14 |
15 | @implementation UIScreen (SCAddition)
16 |
17 | + (CGSize)size
18 | {
19 | return [[UIScreen mainScreen] bounds].size;
20 | }
21 |
22 | + (CGFloat)width
23 | {
24 | return [[UIScreen mainScreen] bounds].size.width;
25 | }
26 |
27 | + (CGFloat)height
28 | {
29 | return [[UIScreen mainScreen] bounds].size.height;
30 | }
31 |
32 | + (CGSize)orientationSize
33 | {
34 | BOOL swap = !SCiOS8OrLater() && [SCApp landscape];
35 | return swap ? SCSizeSWAP([UIScreen size]) : [UIScreen size];
36 | }
37 |
38 | + (CGFloat)orientationWidth
39 | {
40 | return [UIScreen orientationSize].width;
41 | }
42 |
43 | + (CGFloat)orientationHeight
44 | {
45 | return [UIScreen orientationSize].height;
46 | }
47 |
48 | + (BOOL)isFivePointEightInch
49 | {
50 | return ([UIDevice iPhone] && ([UIScreen height] == 812.0 || [UIScreen width] == 812.0));
51 | }
52 |
53 | + (BOOL)isFivePointFiveInch
54 | {
55 | return ([UIDevice iPhone] && ([UIScreen height] == 736.0 || [UIScreen width] == 736.0));
56 | }
57 |
58 | + (BOOL)isFourPointSevenInch
59 | {
60 | return ([UIDevice iPhone] && ([UIScreen height] == 667.0 || [UIScreen width] == 667.0));
61 | }
62 |
63 | + (BOOL)isFourInch
64 | {
65 | return ([UIDevice iPhone] && ([UIScreen height] == 568.0 || [UIScreen width] == 568.0));
66 | }
67 |
68 | + (BOOL)isThreePointFiveInch
69 | {
70 | return ([UIDevice iPhone] && ([UIScreen height] == 480.0 || [UIScreen width] == 480.0));
71 | }
72 |
73 | + (CGSize)DPISize
74 | {
75 | CGSize size = [[UIScreen mainScreen] bounds].size;
76 | CGFloat scale = [[UIScreen mainScreen] scale];
77 | return CGSizeMake(size.width * scale, size.height * scale);
78 | }
79 |
80 | @end
81 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Category/UITableView+SCAddition.h:
--------------------------------------------------------------------------------
1 | //
2 | // UITableView+SCAddition.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 9/26/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface UITableView (SCAddition)
12 |
13 | - (NSIndexPath *)indexPathForCellOfSubView:(UIView *)view;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Category/UITableView+SCAddition.m:
--------------------------------------------------------------------------------
1 | //
2 | // UITableView+SCAddition.m
3 | // SCFramework
4 | //
5 | // Created by Angzn on 9/26/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "UITableView+SCAddition.h"
10 |
11 | @implementation UITableView (SCAddition)
12 |
13 | - (NSIndexPath *)indexPathForCellOfSubView:(UIView *)subview
14 | {
15 | while (subview && !([subview isKindOfClass:[UITableViewCell class]] ||
16 | [subview isMemberOfClass:[UITableViewCell class]])) {
17 | subview = subview.superview;
18 | }
19 | return [self indexPathForCell:(UITableViewCell *)subview];
20 | }
21 |
22 | @end
23 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Category/UIView+SCAddition.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIView+SCAddition.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/4/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | /**
12 | * 锚点位置
13 | */
14 | typedef NS_ENUM(NSUInteger, SCUIViewAnchorPosition){
15 | /**
16 | * 左上角
17 | */
18 | SCUIViewAnchorTopLeft,
19 | /**
20 | * 右上角
21 | */
22 | SCUIViewAnchorTopRight,
23 | /**
24 | * 左下角
25 | */
26 | SCUIViewAnchorBottomLeft,
27 | /**
28 | * 右下角
29 | */
30 | SCUIViewAnchorBottomRight,
31 | /**
32 | * 中心
33 | */
34 | SCUIViewAnchorCenter,
35 | };
36 |
37 | @interface UIView (SCAddition)
38 |
39 | #pragma mark - Frame
40 |
41 | @property (nonatomic) CGPoint origin;
42 | @property (nonatomic) CGSize size;
43 |
44 | @property (nonatomic) CGFloat left;
45 | @property (nonatomic) CGFloat right;
46 |
47 | @property (nonatomic) CGFloat top;
48 | @property (nonatomic) CGFloat bottom;
49 |
50 | @property (nonatomic) CGFloat width;
51 | @property (nonatomic) CGFloat height;
52 |
53 | @property (nonatomic) CGFloat centerX;
54 | @property (nonatomic) CGFloat centerY;
55 |
56 | @property (nonatomic) CGPoint topLeft;
57 | @property (nonatomic) CGPoint topRight;
58 | @property (nonatomic) CGPoint bottomLeft;
59 | @property (nonatomic) CGPoint bottomRight;
60 |
61 | @property (nonatomic, readonly) CGPoint middle;
62 |
63 | @property (nonatomic, readonly) CGSize orientationSize;
64 | @property (nonatomic, readonly) CGFloat orientationWidth;
65 | @property (nonatomic, readonly) CGFloat orientationHeight;
66 | @property (nonatomic, readonly) CGPoint orientationMiddle;
67 |
68 | - (void)setWidth:(CGFloat)width rightAlignment:(BOOL)rightAlignment;
69 | - (void)setHeight:(CGFloat)height bottomAlignment:(BOOL)bottomAlignment;
70 |
71 | - (void)setSize:(CGSize)size anchor:(SCUIViewAnchorPosition)anchor;
72 |
73 | #pragma mark - Border radius
74 |
75 | /**
76 | * @brief 设置圆角
77 | */
78 | - (void)rounded:(CGFloat)cornerRadius;
79 |
80 | /**
81 | * @brief 设置圆角和边框
82 | */
83 | - (void)rounded:(CGFloat)cornerRadius width:(CGFloat)borderWidth color:(UIColor *)borderColor;
84 |
85 | /**
86 | * @brief 设置边框
87 | */
88 | - (void)border:(CGFloat)borderWidth color:(UIColor *)borderColor;
89 |
90 | #pragma mark - Load Nib
91 |
92 | /**
93 | * @brief 从Xib加载视图
94 | *
95 | * @description Loads an instance from the Nib named like the class.
96 | * Returns the first root object of the Nib.
97 | */
98 | + (id)loadFromNib;
99 |
100 | #pragma mark - Animation
101 |
102 | + (void)animateFollowKeyboard:(NSDictionary *)userInfo
103 | animations:(void(^)(NSDictionary *userInfo))animations
104 | completion:(void (^)(BOOL finished))completion;
105 |
106 | #pragma mark - Public Method
107 |
108 | - (UIView *)firstResponder;
109 |
110 | @end
111 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Common/App/SCApp.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCApp.h
3 | // ZhongTouBang
4 | //
5 | // Created by Angzn on 6/11/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | static inline void SCApplicationLock(void) {
12 | [[UIApplication sharedApplication] beginIgnoringInteractionEvents];
13 | }
14 |
15 | static inline void SCApplicationUnLock(void) {
16 | [[UIApplication sharedApplication] endIgnoringInteractionEvents];
17 | }
18 |
19 | @interface SCApp : NSObject
20 |
21 | + (NSString *)name;
22 | + (NSString *)bundleID;
23 | + (NSString *)version;
24 | + (NSString *)displayName;
25 | + (NSString *)shortVersion;
26 |
27 | + (UIInterfaceOrientation)orientation;
28 |
29 | + (BOOL)portrait;
30 | + (BOOL)landscape;
31 |
32 | + (CGSize)size;
33 | + (CGFloat)width;
34 | + (CGFloat)height;
35 |
36 | + (void)lock;
37 | + (void)unlock;
38 |
39 | + (NSString *)appStoreURL:(NSString *)appID;
40 | + (void)launchAppStore:(NSString *)appID;
41 |
42 | + (void)call:(NSString *)tel;
43 |
44 | + (void)configFirstLaunch;
45 | + (BOOL)firstLaunch;
46 |
47 | @end
48 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Common/App/SCApp.m:
--------------------------------------------------------------------------------
1 | //
2 | // SCApp.m
3 | // ZhongTouBang
4 | //
5 | // Created by Angzn on 6/11/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCApp.h"
10 | #import "SCMath.h"
11 | #import "SCAdaptedSystem.h"
12 | #import "SCUserDefaultManager.h"
13 |
14 | static NSString * const SCAppStoreURL = @"https://itunes.apple.com/app/id";
15 |
16 | /**
17 | * App是否已经启动过
18 | */
19 | static NSString * const SCAppEverLaunchedKey = @"SCAppEverLaunchedKey";
20 | /**
21 | * App是否第一次启动
22 | */
23 | static NSString * const SCAppFirstLaunchKey = @"SCAppFirstLaunchKey";
24 |
25 | @implementation SCApp
26 |
27 | + (NSString *)name
28 | {
29 | return [[NSBundle mainBundle] infoDictionary][(NSString*)kCFBundleExecutableKey];
30 | }
31 |
32 | + (NSString *)bundleID
33 | {
34 | return [[NSBundle mainBundle] infoDictionary][(NSString*)kCFBundleIdentifierKey];
35 | }
36 |
37 | + (NSString *)version
38 | {
39 | return [[NSBundle mainBundle] infoDictionary][(NSString*)kCFBundleVersionKey];
40 | }
41 |
42 | + (NSString *)displayName
43 | {
44 | return [[NSBundle mainBundle] infoDictionary][@"CFBundleDisplayName"];
45 | }
46 |
47 | + (NSString *)shortVersion
48 | {
49 | return [[NSBundle mainBundle] infoDictionary][@"CFBundleShortVersionString"];
50 | }
51 |
52 | + (UIInterfaceOrientation)orientation
53 | {
54 | return [UIApplication sharedApplication].statusBarOrientation;
55 | }
56 |
57 | + (BOOL)portrait
58 | {
59 | return UIInterfaceOrientationIsPortrait([SCApp orientation]);
60 | }
61 |
62 | + (BOOL)landscape
63 | {
64 | return UIInterfaceOrientationIsLandscape([SCApp orientation]);
65 | }
66 |
67 | + (CGSize)size
68 | {
69 | CGSize size = [[UIScreen mainScreen] bounds].size;
70 | return SCiOS8OrLater() || [SCApp portrait] ? size : SCSizeSWAP(size);
71 | }
72 |
73 | + (CGFloat)width
74 | {
75 | return [SCApp size].width;
76 | }
77 |
78 | + (CGFloat)height
79 | {
80 | return [SCApp size].height;
81 | }
82 |
83 | + (void)lock
84 | {
85 | [[UIApplication sharedApplication] beginIgnoringInteractionEvents];
86 | }
87 |
88 | + (void)unlock
89 | {
90 | [[UIApplication sharedApplication] endIgnoringInteractionEvents];
91 | }
92 |
93 | + (NSString *)appStoreURL:(NSString *)appID
94 | {
95 | return [NSString stringWithFormat:@"%@%@", SCAppStoreURL, appID];
96 | }
97 |
98 | + (void)launchAppStore:(NSString *)appID
99 | {
100 | NSString *downloadURLString = [self.class appStoreURL:appID];
101 | NSURL *downloadURL = [NSURL URLWithString:downloadURLString];
102 | [[UIApplication sharedApplication] openURL:downloadURL];
103 | }
104 |
105 | + (void)call:(NSString *)tel
106 | {
107 | NSString *callString = [NSString stringWithFormat:@"telprompt://%@", tel];
108 | NSURL *callURL = [NSURL URLWithString:callString];
109 | [[UIApplication sharedApplication] openURL:callURL];
110 | }
111 |
112 | + (void)configFirstLaunch
113 | {
114 | NSString *everLaunchKey = [NSString stringWithFormat:@"%@_%@",
115 | SCAppEverLaunchedKey, [SCApp bundleID]];
116 | NSString *firstLaunchKey = [NSString stringWithFormat:@"%@_%@",
117 | SCAppFirstLaunchKey, [SCApp bundleID]];
118 | if ([[SCUserDefaultManager sharedInstance] getBoolForKey:everLaunchKey]) {
119 | [[SCUserDefaultManager sharedInstance] setBool:NO forKey:firstLaunchKey];
120 | } else {
121 | [[SCUserDefaultManager sharedInstance] setBool:YES forKey:everLaunchKey];
122 | [[SCUserDefaultManager sharedInstance] setBool:YES forKey:firstLaunchKey];
123 | }
124 | }
125 |
126 | + (BOOL)firstLaunch
127 | {
128 | NSString *firstLaunchKey = [NSString stringWithFormat:@"%@_%@",
129 | SCAppFirstLaunchKey, [SCApp bundleID]];
130 | return [[SCUserDefaultManager sharedInstance] getBoolForKey:firstLaunchKey];
131 | }
132 |
133 | @end
134 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Common/Foundation/SCJSONSerializing.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCJSONSerializing.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 2/5/15.
6 | // Copyright (c) 2015 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @protocol SCJSONSerializing
12 |
13 | @optional
14 |
15 | /**
16 | * @brief 返回属性字段名与JSON字段名键值对
17 | *
18 | * @return {属性名字段:JSON字段名, ...}键值对
19 | */
20 | + (NSDictionary *)JSONKeysByPropertyKey;
21 |
22 | @end
23 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Common/Foundation/SCModel.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCModel.h
3 | // ZhongTouBang
4 | //
5 | // Created by Angzn on 6/16/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #import "SCJSONSerializing.h"
12 |
13 | @interface SCModel : NSObject
14 | <
15 | SCJSONSerializing,
16 | NSSecureCoding,
17 | NSCopying
18 | >
19 |
20 | /**
21 | * @brief 初始化对象
22 | *
23 | * @param dictionary 数据模型所有字段键值对
24 | *
25 | * @return 数据模型对象
26 | */
27 | - (instancetype)initWithPropertyDictionary:(NSDictionary *)dictionary;
28 |
29 | /**
30 | * @brief 解析数据模型为字典
31 | *
32 | * @return 数据模型所有字段键值对
33 | */
34 | - (NSDictionary *)dictionaryRepresentation;
35 |
36 | /**
37 | * @brief 初始化对象
38 | *
39 | * @param path 本地化文件路径
40 | *
41 | * @return 数据模型对象
42 | */
43 | + (instancetype)objectWithContentsOfFile:(NSString *)path;
44 |
45 | /**
46 | * @brief 保存对象到文件
47 | *
48 | * @param filePath 本地化文件路径
49 | * @param useAuxiliaryFile 原子性
50 | *
51 | * @return YES, 保存成功; NO, 保存失败
52 | */
53 | - (BOOL)writeToFile:(NSString *)filePath atomically:(BOOL)useAuxiliaryFile;
54 |
55 | /**
56 | * @brief 解析数据模型为字典
57 | *
58 | * @return JSON所有字段键值对
59 | */
60 | - (NSDictionary *)JSONDictionary;
61 |
62 | /**
63 | * @brief 根据属性字段名获取JSON字段名
64 | *
65 | * @param propertyKey 属性字段名
66 | *
67 | * @return JSON字段名
68 | */
69 | - (NSString *)JSONKeyForPropertyKey:(NSString *)propertyKey;
70 |
71 | @end
72 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Common/Foundation/SCNSJSONSerialization.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCNSJSONSerialization.h
3 | // ZhongTouBang
4 | //
5 | // Created by Angzn on 6/11/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface SCNSJSONSerialization : NSObject
12 |
13 | + (id)objectFromData:(NSData *)data;
14 | + (NSData *)dataFromObject:(id)object;
15 |
16 | + (id)objectFromData:(NSData *)data error:(NSError **)error;
17 | + (NSData *)dataFromObject:(id)object error:(NSError **)error;
18 |
19 | + (id)objectFromString:(NSString *)string;
20 | + (NSString *)stringFromObject:(id)object;
21 |
22 | + (id)objectFromString:(NSString *)string error:(NSError **)error;
23 | + (NSString *)stringFromObject:(id)object error:(NSError **)error;
24 |
25 | @end
26 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Common/Foundation/SCNSJSONSerialization.m:
--------------------------------------------------------------------------------
1 | //
2 | // SCNSJSONSerialization.m
3 | // ZhongTouBang
4 | //
5 | // Created by Angzn on 6/11/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCNSJSONSerialization.h"
10 |
11 | @implementation SCNSJSONSerialization
12 |
13 | + (id)objectFromData:(NSData *)data
14 | {
15 | return [self.class objectFromData:data error:nil];
16 | }
17 |
18 | + (NSData *)dataFromObject:(id)object
19 | {
20 | return [self.class dataFromObject:object error:nil];
21 | }
22 |
23 | + (id)objectFromData:(NSData *)data error:(NSError **)error
24 | {
25 | return [NSJSONSerialization JSONObjectWithData:data options:0 error:error];
26 | }
27 |
28 | + (NSData *)dataFromObject:(id)object error:(NSError **)error
29 | {
30 | return [NSJSONSerialization dataWithJSONObject:object options:0 error:error];
31 | }
32 |
33 | + (id)objectFromString:(NSString *)string
34 | {
35 | return [self.class objectFromString:string error:nil];
36 | }
37 |
38 | + (NSString *)stringFromObject:(id)object
39 | {
40 | return [self.class stringFromObject:object error:nil];
41 | }
42 |
43 | + (id)objectFromString:(NSString *)string error:(NSError *__autoreleasing *)error
44 | {
45 | NSData *JSONData = [string dataUsingEncoding:NSUTF8StringEncoding];
46 | return [self.class objectFromData:JSONData error:error];
47 | }
48 |
49 | + (NSString *)stringFromObject:(id)object error:(NSError *__autoreleasing *)error
50 | {
51 | NSData *JSONData = [self.class dataFromObject:object error:error];
52 | NSString *JSONString = [[NSString alloc] initWithData:JSONData
53 | encoding:NSUTF8StringEncoding];
54 | return JSONString;
55 | }
56 |
57 | @end
58 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Common/Math/SCMath.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCMath.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 5/4/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | /**
12 | * 是否等于零
13 | */
14 | static inline BOOL SCMathEqualZero(double number) {
15 | const double EPSINON = 1.00e-07;//此处根据精度定
16 | return (number >= -EPSINON) && (number <= EPSINON);
17 | }
18 |
19 | /**
20 | * 四舍五入
21 | *
22 | * @param number 数字
23 | * @param digit 小数点位数
24 | */
25 | static inline CGFloat SCMathRound(CGFloat number, NSInteger digit) {
26 | double powNum = pow(10, digit);
27 | return round(number * powNum) / powNum;
28 | }
29 |
30 | /**
31 | * 数字一半
32 | */
33 | static inline CGFloat SCMathHalf(CGFloat number) {
34 | return number / 2.0;
35 | };
36 |
37 | /**
38 | * 数字两倍
39 | */
40 | static inline CGFloat SCMathDouble(CGFloat number) {
41 | return number * 2.0;
42 | };
43 |
44 | /**
45 | * 角度转弧度
46 | */
47 | static inline CGFloat SCMathDegreesToRadians(CGFloat degrees) {
48 | return degrees * (M_PI / 180);
49 | };
50 |
51 | /**
52 | * 弧度转角度
53 | */
54 | static inline CGFloat SCMathRadiansToDegrees(CGFloat radians) {
55 | return radians * (180 / M_PI);
56 | };
57 |
58 | /**
59 | * 数字交换
60 | */
61 | static inline void SCMathSWAP(CGFloat *a, CGFloat *b) {
62 | CGFloat t;
63 | t = *a;
64 | *a = *b;
65 | *b = t;
66 | };
67 |
68 | /**
69 | * 取整
70 | */
71 | static inline CGFloat SCRectRound(CGFloat number) {
72 | return ceil(number);
73 | }
74 |
75 | /**
76 | * 上取整(不小于/大于等于)
77 | */
78 | static inline CGFloat SCRectCeil(CGFloat number) {
79 | return ceil(number);
80 | }
81 |
82 | /**
83 | * 下取整(不大于/小于等于)
84 | */
85 | static inline CGFloat SCRectFloor(CGFloat number) {
86 | return floor(number);
87 | }
88 |
89 | /**
90 | * 交换高度与宽度
91 | */
92 | static inline CGSize SCSizeSWAP(CGSize size) {
93 | return CGSizeMake(size.height, size.width);
94 | }
95 |
96 | /**
97 | * 根据字体像素(px)大小获取字体磅(pt)大小
98 | */
99 | //static inline CGFloat SCFontSizeFromPx(CGFloat px) {
100 | // return 0;
101 | //}
102 |
103 | @interface SCMath : NSObject
104 |
105 | @end
106 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Common/Math/SCMath.m:
--------------------------------------------------------------------------------
1 | //
2 | // SCMath.m
3 | // SCFramework
4 | //
5 | // Created by Angzn on 5/4/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCMath.h"
10 |
11 | @implementation SCMath
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Common/Utils/SCUtils.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCUtils.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 8/22/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | /**
12 | * 获取网络信息(Wi-Fi情况下)
13 | */
14 | NSDictionary * SCGETCurrentNetworkInfo(void);
15 |
16 | /**
17 | * 获取IP地址(Wi-Fi情况下)
18 | */
19 | NSString * SCGETIPAddress(void);
20 |
21 | @interface SCUtils : NSObject
22 |
23 | @end
24 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Common/Utils/SCUtils.m:
--------------------------------------------------------------------------------
1 | //
2 | // SCUtils.m
3 | // SCFramework
4 | //
5 | // Created by Angzn on 8/22/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCUtils.h"
10 | #import
11 | #import
12 | #import
13 |
14 | NSDictionary * SCGETCurrentNetworkInfo(void)
15 | {
16 | NSDictionary *networkInfo = nil;
17 | CFArrayRef interfaces = CNCopySupportedInterfaces();
18 | if (interfaces != NULL) {
19 | CFStringRef interfaceName = CFArrayGetValueAtIndex(interfaces, 0);
20 | CFDictionaryRef networkInfoRef = CNCopyCurrentNetworkInfo(interfaceName);
21 | if (networkInfoRef != NULL) {
22 | networkInfo = (__bridge NSDictionary *)(networkInfoRef);
23 | CFRelease(networkInfoRef);
24 | }
25 | CFRelease(interfaces);
26 | }
27 | return networkInfo;
28 | }
29 |
30 | NSString * SCGETIPAddress(void)
31 | {
32 | NSString *address = nil;
33 | struct ifaddrs *interfaces = NULL;
34 | struct ifaddrs *temp_addr = NULL;
35 | int success = 0;
36 | // retrieve the current interfaces - returns 0 on success
37 | success = getifaddrs(&interfaces);
38 | if (success == 0) {
39 | // Loop through linked list of interfaces
40 | temp_addr = interfaces;
41 | while (temp_addr != NULL) {
42 | if (temp_addr->ifa_addr->sa_family == AF_INET) {
43 | // Check if interface is en0 which is the wifi connection on the iPhone
44 | if ([[NSString stringWithUTF8String:temp_addr->ifa_name] isEqualToString:@"en0"]) {
45 | // Get NSString from C String
46 | char * cAddress = inet_ntoa(((struct sockaddr_in *)temp_addr->ifa_addr)->sin_addr);
47 | address = [NSString stringWithUTF8String:cAddress];
48 | }
49 | }
50 | temp_addr = temp_addr->ifa_next;
51 | }
52 | }
53 | // Free memory
54 | freeifaddrs(interfaces);
55 | return address;
56 | }
57 |
58 | @implementation SCUtils
59 |
60 | @end
61 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Constant/SCConstant.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCConstant.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/5/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #import "SCMacro.h"
12 |
13 | #define kSCFW_STATUSBAR_HEIGHT (kSC_iPhoneX_OR_LATER ? 44.0 : 20.0)
14 | #define kSCFW_NAVIGATIONBAR_HEIGHT (kSC_iPhoneX_OR_LATER ? 44.0 : 44.0)
15 | #define kSCFW_TABBAR_HEIGHT (kSC_iPhoneX_OR_LATER ? 83.0 : 49.0)
16 |
17 | //extern const CGFloat kSCFW_STATUSBAR_HEIGHT;
18 | //extern const CGFloat kSCFW_NAVIGATIONBAR_HEIGHT;
19 | //extern const CGFloat kSCFW_TABBAR_HEIGHT;
20 | extern const CGFloat kSCFW_CELL_DEFAULT_HEIGHT;
21 | extern const CGFloat kSCFW_TOOLBAR_HEIGHT;
22 | extern const CGFloat kSCFW_PICKERVIEW_HEIGHT;
23 | extern const CGFloat kSCFW_DATEPICKER_HEIGHT;
24 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Constant/SCConstant.m:
--------------------------------------------------------------------------------
1 | //
2 | // SCConstant.m
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/5/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCConstant.h"
10 |
11 | //const CGFloat kSCFW_STATUSBAR_HEIGHT = 20.f;
12 | //const CGFloat kSCFW_NAVIGATIONBAR_HEIGHT = 44.0;
13 | //const CGFloat kSCFW_TABBAR_HEIGHT = 49.0;
14 | const CGFloat kSCFW_CELL_DEFAULT_HEIGHT = 44.0;
15 | const CGFloat kSCFW_TOOLBAR_HEIGHT = 44.0;
16 | const CGFloat kSCFW_PICKERVIEW_HEIGHT = 216.0;
17 | const CGFloat kSCFW_DATEPICKER_HEIGHT = 216.0;
18 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Manager/DaoManager/NSFetchRequest+SCDaoAddition.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSFetchRequest+SCDaoAddition.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 4/24/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface NSFetchRequest (SCDaoAddition)
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Manager/DaoManager/NSFetchRequest+SCDaoAddition.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSFetchRequest+SCDaoAddition.m
3 | // SCFramework
4 | //
5 | // Created by Angzn on 4/24/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "NSFetchRequest+SCDaoAddition.h"
10 |
11 | @implementation NSFetchRequest (SCDaoAddition)
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Manager/DaoManager/NSManagedObject+SCDaoAddition.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSManagedObject+SCDaoAddition.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 4/24/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface NSManagedObject (SCDaoAddition)
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Manager/DaoManager/NSManagedObject+SCDaoAddition.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSManagedObject+SCDaoAddition.m
3 | // SCFramework
4 | //
5 | // Created by Angzn on 4/24/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "NSManagedObject+SCDaoAddition.h"
10 |
11 | @implementation NSManagedObject (SCDaoAddition)
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Manager/DaoManager/SCCoreDataManager.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCCoreDataManager.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/5/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface SCCoreDataManager : NSObject
13 | {
14 | @private
15 | NSManagedObjectModel *_managedObjectModel;
16 | NSManagedObjectContext *_managedObjectContext;
17 | NSPersistentStoreCoordinator *_persistentStoreCoordinator;
18 | }
19 |
20 | @property (nonatomic, strong, readonly) NSManagedObjectModel *managedObjectModel;
21 | @property (nonatomic, strong, readonly) NSManagedObjectContext *managedObjectContext;
22 | @property (nonatomic, strong, readonly) NSPersistentStoreCoordinator *persistentStoreCoordinator;
23 |
24 | + (SCCoreDataManager *)sharedInstance;
25 |
26 | - (NSURL *)applicationDocumentsDirectory;
27 |
28 | #pragma mark - 配置
29 |
30 | - (void)setupDataMomdFile:(NSString *)momdFileName
31 | databaseFile:(NSString *)dbFileName;
32 |
33 | - (void)setupDataMomdFile:(NSString *)momdFileName
34 | databaseFile:(NSString *)dbFileName
35 | databaseExt:(NSString *)dbFileExt;
36 |
37 | #pragma mark - 创建对象
38 |
39 | - (NSManagedObject *)newObjectWithEntityName:(NSString *)name;
40 | - (NSManagedObject *)newObject:(Class)objClass
41 | entityName:(NSString *)name;
42 |
43 | #pragma mark - 数据操作
44 |
45 | - (BOOL)save;
46 |
47 | - (BOOL)insertObject:(NSManagedObject *)obj;
48 | - (BOOL)deleteObject:(NSManagedObject *)obj;
49 | - (BOOL)refreshObject:(NSManagedObject *)obj
50 | mergeChanges:(BOOL)flag;
51 |
52 | - (BOOL)insertObject:(NSManagedObject *)obj
53 | saveChange:(BOOL)saveChange;
54 | - (BOOL)deleteObject:(NSManagedObject *)obj
55 | saveChange:(BOOL)saveChange;
56 | - (BOOL)refreshObject:(NSManagedObject *)obj
57 | mergeChanges:(BOOL)flag
58 | saveChange:(BOOL)saveChange;
59 |
60 | @end
61 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Manager/DaoManager/SCDaoManager.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCDaoManager.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 5/5/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #import
12 |
13 | @class SCModel;
14 |
15 | @protocol SCDatabaseModel;
16 |
17 | @interface SCDaoManager : NSObject
18 |
19 | @property (nonatomic, readonly) FMDatabase *db;
20 |
21 | + (SCDaoManager *)sharedInstance;
22 |
23 | - (instancetype)initWithName:(NSString *)dbName;
24 | - (instancetype)initWithPath:(NSString *)dbPath;
25 |
26 | - (NSArray *)datebaseMetas;
27 |
28 | - (NSArray *)tableMetas:(Class)modelCls;
29 |
30 | - (BOOL)checkTableAndAlertIfNeed:(Class)modelCls;
31 |
32 | - (BOOL)existTable:(Class)modelCls;
33 |
34 | - (BOOL)createTable:(Class)modelCls;
35 |
36 | - (BOOL)dropTable:(Class)modelCls;
37 |
38 | - (BOOL)insertModel:(SCModel *)model;
39 |
40 | - (BOOL)insertModels:(NSArray *> *)models;
41 |
42 | - (BOOL)insertModels:(NSArray *> *)models rollbackWhenError:(BOOL)rollbackWhenError;
43 |
44 | - (BOOL)deleteModel:(Class)modelCls;
45 |
46 | - (BOOL)deleteModel:(Class)modelCls forSQL:(NSString *)SQL;
47 |
48 | - (BOOL)updateModel:(Class)modelCls forSQL:(NSString *)SQL;
49 |
50 | - (NSArray *)query:(Class)modelCls;
51 | - (NSArray *)query:(Class)modelCls where:(id)where;
52 | - (NSArray *)query:(Class)modelCls forSQL:(NSString *)SQL;
53 |
54 | - (NSInteger)count:(Class)modelCls forSQL:(NSString *)SQL;
55 |
56 | @end
57 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Manager/DaoManager/SCDatabase.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCDatabase.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 8/21/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | static NSString * const SCSQLTypeText = @"text";
12 | static NSString * const SCSQLTypeInt = @"integer";
13 | static NSString * const SCSQLTypeDouble = @"double";
14 | static NSString * const SCSQLTypeBlob = @"blob";
15 |
16 | static NSString * const SCSQLAttributeNotNull = @"NOT NULL";
17 | static NSString * const SCSQLAttributePrimaryKey = @"PRIMARY KEY";
18 | static NSString * const SCSQLAttributeDefault = @"DEFAULT";
19 | static NSString * const SCSQLAttributeUnique = @"UNIQUE";
20 | static NSString * const SCSQLAttributeCheck = @"CHECK";
21 | static NSString * const SCSQLAttributeForeignKey = @"FOREIGN KEY";
22 |
23 | static NSString * const SCSQLAttributeAutoIncremnt = @"AUTOINCREMENT";
24 |
25 | /**
26 | * Object-c type converted to SQLite type (把Objective-C类型转换为SQL类型)
27 | *
28 | * @param objcType Objective-C类型
29 | *
30 | * @return SQL类型
31 | */
32 | extern NSString * SCSQLTypeFromObjcType(NSString * objcType);
33 |
34 | @interface SCDatabase : NSObject
35 |
36 | @end
37 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Manager/DaoManager/SCDatabase.m:
--------------------------------------------------------------------------------
1 | //
2 | // SCDatabase.m
3 | // SCFramework
4 | //
5 | // Created by Angzn on 8/21/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCDatabase.h"
10 | #import "NSObject+SCAddition.h"
11 |
12 | inline NSString * SCSQLTypeFromObjcType(NSString * objcType)
13 | {
14 | if ([objcType isEqualToString:SCObjcTypeChar]) {
15 | return SCSQLTypeInt;
16 | } else if ([objcType isEqualToString:SCObjcTypeInt]) {
17 | return SCSQLTypeInt;
18 | } else if ([objcType isEqualToString:SCObjcTypeShort]) {
19 | return SCSQLTypeInt;
20 | } else if ([objcType isEqualToString:SCObjcTypeInt32]) {
21 | return SCSQLTypeInt;
22 | } else if ([objcType isEqualToString:SCObjcTypeInt64]) {
23 | return SCSQLTypeInt;
24 | } else if ([objcType isEqualToString:SCObjcTypeUChar]) {
25 | return SCSQLTypeInt;
26 | } else if ([objcType isEqualToString:SCObjcTypeUInt]) {
27 | return SCSQLTypeInt;
28 | } else if ([objcType isEqualToString:SCObjcTypeUShort]) {
29 | return SCSQLTypeInt;
30 | } else if ([objcType isEqualToString:SCObjcTypeUInt32]) {
31 | return SCSQLTypeInt;
32 | } else if ([objcType isEqualToString:SCObjcTypeUInt64]) {
33 | return SCSQLTypeInt;
34 | } else if ([objcType isEqualToString:SCObjcTypeFloat]) {
35 | return SCSQLTypeDouble;
36 | } else if ([objcType isEqualToString:SCObjcTypeDouble]) {
37 | return SCSQLTypeDouble;
38 | } else if ([objcType isEqualToString:SCObjcTypeBool]) {
39 | return SCSQLTypeInt;
40 | } else if ([objcType isEqualToString:SCObjcTypeCGPoint]) {
41 | return SCSQLTypeText;
42 | } else if ([objcType isEqualToString:SCObjcTypeCGSize]) {
43 | return SCSQLTypeText;
44 | } else if ([objcType isEqualToString:SCObjcTypeCGRect]) {
45 | return SCSQLTypeText;
46 | } else if ([objcType isEqualToString:SCObjcTypeNSDate]) {
47 | return SCSQLTypeDouble;
48 | } else if ([objcType isEqualToString:SCObjcTypeNSData]) {
49 | return SCSQLTypeBlob;
50 | } else if ([objcType isEqualToString:SCObjcTypeNSString]) {
51 | return SCSQLTypeText;
52 | }
53 | return SCSQLTypeText;
54 | }
55 |
56 | @implementation SCDatabase
57 |
58 | @end
59 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Manager/DaoManager/SCDatabaseManager.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCDatabaseManager.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 16/4/21.
6 | // Copyright © 2016年 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #import
12 |
13 | @class SCModel;
14 |
15 | @protocol SCDatabaseModel;
16 |
17 | @interface SCDatabaseManager : NSObject
18 |
19 | @property (nonatomic, readonly) FMDatabaseQueue *dbQueue;
20 |
21 | + (SCDatabaseManager *)sharedInstance;
22 |
23 | - (instancetype)initWithName:(NSString *)dbName;
24 | - (instancetype)initWithPath:(NSString *)dbPath;
25 |
26 | - (NSArray *)datebaseMetas;
27 |
28 | - (NSArray *)tableMetas:(Class)modelCls;
29 |
30 | - (BOOL)checkTableAndAlertIfNeed:(Class)modelCls;
31 |
32 | - (BOOL)existTable:(Class)modelCls;
33 |
34 | - (BOOL)createTable:(Class)modelCls;
35 |
36 | - (BOOL)dropTable:(Class)modelCls;
37 |
38 | - (BOOL)insertModel:(SCModel *)model;
39 |
40 | - (BOOL)insertModels:(NSArray *> *)models;
41 |
42 | - (BOOL)insertModels:(NSArray *> *)models rollbackWhenError:(BOOL)rollbackWhenError;
43 |
44 | - (BOOL)deleteModel:(Class)modelCls;
45 |
46 | - (BOOL)deleteModel:(Class)modelCls forSQL:(NSString *)SQL;
47 |
48 | - (BOOL)updateModel:(Class)modelCls forSQL:(NSString *)SQL;
49 |
50 | - (NSArray *)query:(Class)modelCls;
51 | - (NSArray *)query:(Class)modelCls where:(id)where;
52 | - (NSArray *)query:(Class)modelCls forSQL:(NSString *)SQL;
53 |
54 | - (NSInteger)count:(Class)modelCls forSQL:(NSString *)SQL;
55 |
56 | @end
57 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Manager/DaoManager/SCDatabaseMetaModel.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCDatabaseMetaModel.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 16/4/15.
6 | // Copyright © 2016年 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCModel.h"
10 |
11 | @interface SCDatabaseMetaModel : SCModel
12 |
13 | /**
14 | * @brief 元项类型(如:'table'/'index')
15 | */
16 | @property (nonatomic, copy ) NSString *type;
17 | /**
18 | * @brief 元项名称(如:表格名称、索引名称)
19 | */
20 | @property (nonatomic, copy ) NSString *name;
21 | /**
22 | * @brief 元项对应表格名称(如:索引对应表格)
23 | */
24 | @property (nonatomic, copy ) NSString *tableName;
25 | /**
26 | * @brief 创建SQL语句
27 | */
28 | @property (nonatomic, copy ) NSString *sql;
29 |
30 | @end
31 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Manager/DaoManager/SCDatabaseMetaModel.m:
--------------------------------------------------------------------------------
1 | //
2 | // SCDatabaseMetaModel.m
3 | // SCFramework
4 | //
5 | // Created by Angzn on 16/4/15.
6 | // Copyright © 2016年 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCDatabaseMetaModel.h"
10 |
11 | @implementation SCDatabaseMetaModel
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Manager/DaoManager/SCDatabaseModel.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCDatabaseModel.h
3 | // ZhongTouBang
4 | //
5 | // Created by Angzn on 8/22/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @protocol SCDatabaseModel
12 |
13 | @required
14 | /**
15 | * @brief 数据库表名称
16 | */
17 | + (NSString *)tableName;
18 |
19 | @optional
20 | /**
21 | * @brief 数据库表主键
22 | *
23 | * @discussion 支持单主键和多主键, 多主键用逗号隔开
24 | */
25 | + (NSString *)primaryKey;
26 |
27 | @end
28 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Manager/DaoManager/SCKeyValueStore.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCKeyValueStore.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 15/1/8.
6 | // Copyright (c) 2015年 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface SCKeyValueItem : NSObject
12 |
13 | /**
14 | * 键(数据键)
15 | */
16 | @property (strong, nonatomic) NSString *key;
17 | /**
18 | * 值(数据对象)
19 | */
20 | @property (strong, nonatomic) id value;
21 | /**
22 | * 创建时间
23 | */
24 | @property (strong, nonatomic) NSDate *createdTime;
25 |
26 | @end
27 |
28 |
29 | @interface SCKeyValueStore : NSObject
30 |
31 | + (SCKeyValueStore *)sharedInstance;
32 |
33 | - (instancetype)initWithName:(NSString *)dbName;
34 | - (instancetype)initWithPath:(NSString *)dbPath;
35 |
36 | - (BOOL)existTable:(NSString *)tableName;
37 | - (BOOL)createTable:(NSString *)tableName;
38 | - (BOOL)dropTable:(NSString *)tableName;
39 |
40 | - (SCKeyValueItem *)queryItemForKey:(NSString *)key fromTable:(NSString *)tableName;
41 | - (NSArray *)queryForKeyContainPrefix:(NSString *)keyPrefix fromTable:(NSString *)tableName;
42 | - (NSArray *)queryFromTable:(NSString *)tableName;
43 |
44 | - (BOOL)putObject:(id)object forKey:(NSString *)key intoTable:(NSString *)tableName;
45 | - (id)getObjectForKey:(NSString *)key fromTable:(NSString *)tableName;
46 |
47 | - (BOOL)putString:(NSString *)string forKey:(NSString *)key intoTable:(NSString *)tableName;
48 | - (NSString *)getStringForKey:(NSString *)key fromTable:(NSString *)tableName;
49 |
50 | - (BOOL)putNumber:(NSNumber *)number forKey:(NSString *)key intoTable:(NSString *)tableName;
51 | - (NSNumber *)getNumberForKey:(NSString *)key fromTable:(NSString *)tableName;
52 |
53 | - (BOOL)deleteForKey:(NSString *)key fromTable:(NSString *)tableName;
54 | - (BOOL)deleteForKeys:(NSArray *)keys fromTable:(NSString *)tableName;
55 | - (BOOL)deleteForKeyContainPrefix:(NSString *)keyPrefix fromTable:(NSString *)tableName;
56 | - (BOOL)deleteFromTable:(NSString *)tableName;
57 |
58 | - (void)close;
59 |
60 | @end
61 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Manager/DaoManager/SCTableMetaModel.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCTableMetaModel.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 16/4/15.
6 | // Copyright © 2016年 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCModel.h"
10 |
11 | @interface SCTableMetaModel : SCModel
12 |
13 | /**
14 | * @brief 表格列ID
15 | */
16 | @property (nonatomic, assign) NSInteger columnID;
17 | /**
18 | * @brief 列名称
19 | */
20 | @property (nonatomic, copy ) NSString *name;
21 | /**
22 | * @brief 数据类型
23 | */
24 | @property (nonatomic, copy ) NSString *type;
25 | /**
26 | * @brief 是否不为空
27 | */
28 | @property (nonatomic, assign) BOOL isNotNull;
29 | /**
30 | * @brief 是否为主键
31 | */
32 | @property (nonatomic, assign) BOOL isPrimaryKey;
33 | /**
34 | * @brief 默认值
35 | */
36 | @property (nonatomic, strong) id defaultValue;
37 |
38 | @end
39 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Manager/DaoManager/SCTableMetaModel.m:
--------------------------------------------------------------------------------
1 | //
2 | // SCTableMetaModel.m
3 | // SCFramework
4 | //
5 | // Created by Angzn on 16/4/15.
6 | // Copyright © 2016年 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCTableMetaModel.h"
10 |
11 | @implementation SCTableMetaModel
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Manager/DateManager/SCDateManager.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCDateManager.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/6/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface SCDateManager : NSObject
12 |
13 | + (SCDateManager *)sharedInstance;
14 |
15 | - (NSString *)stringByConvertFromDate:(NSDate *)date format:(NSString *)format;
16 | - (NSDate *)dateByConvertFromString:(NSString *)string format:(NSString *)format;
17 | - (NSString *)dateWithTimeIntervalSince1970:(NSTimeInterval)secs format:(NSString *)format;
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Manager/DateManager/SCDateManager.m:
--------------------------------------------------------------------------------
1 | //
2 | // SCDateManager.m
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/6/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCDateManager.h"
10 | #import "SCSingleton.h"
11 |
12 | @interface SCDateManager ()
13 |
14 | @property (nonatomic, strong) NSDateFormatter *dateForrmatter;
15 |
16 | @end
17 |
18 |
19 | @implementation SCDateManager
20 |
21 | SCSINGLETON(SCDateManager);
22 |
23 | - (id)init
24 | {
25 | self = [super init];
26 | if (self) {
27 | _dateForrmatter = [[NSDateFormatter alloc] init];
28 | [_dateForrmatter setLocale:[NSLocale currentLocale]];
29 | [_dateForrmatter setTimeZone:[NSTimeZone localTimeZone]];
30 | }
31 | return self;
32 | }
33 |
34 | - (NSString *)stringByConvertFromDate:(NSDate *)date format:(NSString *)format
35 | {
36 | [_dateForrmatter setDateFormat:format];
37 | NSString *dateString = [_dateForrmatter stringFromDate:date];
38 | return dateString;
39 | }
40 |
41 | - (NSDate *)dateByConvertFromString:(NSString *)string format:(NSString *)format
42 | {
43 | [_dateForrmatter setDateFormat:format];
44 | NSDate *date = [_dateForrmatter dateFromString:string];
45 | return date;
46 | }
47 |
48 | - (NSString *)dateWithTimeIntervalSince1970:(NSTimeInterval)secs format:(NSString *)format
49 | {
50 | NSDate *date = [NSDate dateWithTimeIntervalSince1970:secs];
51 | return [self stringByConvertFromDate:date format:format];
52 | }
53 |
54 | @end
55 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Manager/FileManager/SCFileManager.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCFileManager.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/6/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface SCFileManager : NSObject
12 |
13 | + (SCFileManager *)sharedInstance;
14 |
15 | - (BOOL)fileExistsAtPath:(NSString *)filePath;
16 |
17 | - (BOOL)createFileAtPath:(NSString *)filePath;
18 | - (BOOL)createDirectoryAtPath:(NSString *)path;
19 | - (BOOL)removeFileAtPath:(NSString *)filePath;
20 |
21 | - (NSData *)dataWithFilePath:(NSString *)filePath;
22 | - (BOOL)saveData:(NSData *)data toFilePath:(NSString *)filePath;
23 | - (NSDictionary *)dictionaryWithFilePath:(NSString *)filePath;
24 | - (BOOL)saveDictionary:(NSDictionary *)data toFilePath:(NSString *)filePath;
25 | - (NSArray *)arrayWithFilePath:(NSString *)filePath;
26 | - (BOOL)saveArray:(NSArray *)data toFilePath:(NSString *)filePath;
27 |
28 | @end
29 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Manager/FileManager/SCFileManager.m:
--------------------------------------------------------------------------------
1 | //
2 | // SCFileManager.m
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/6/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCFileManager.h"
10 | #import "SCSingleton.h"
11 |
12 | @interface SCFileManager ()
13 |
14 | @property (nonatomic, weak) NSFileManager *fileManager;
15 |
16 | @end
17 |
18 |
19 | @implementation SCFileManager
20 |
21 | SCSINGLETON(SCFileManager);
22 |
23 | - (id)init
24 | {
25 | self = [super init];
26 | if (self) {
27 | _fileManager = [NSFileManager defaultManager];
28 | }
29 | return self;
30 | }
31 |
32 | #pragma mark - 判断文件是否存在
33 |
34 | /**
35 | * @brief 判断文件是否存在
36 | */
37 | - (BOOL)fileExistsAtPath:(NSString *)filePath
38 | {
39 | return [_fileManager fileExistsAtPath:filePath];
40 | }
41 |
42 | #pragma mark - 文件创建/移除
43 |
44 | /**
45 | * @brief 创建文件
46 | */
47 | - (BOOL)createFileAtPath:(NSString *)filePath
48 | {
49 | if ( [self fileExistsAtPath:filePath] ) {
50 | return YES;
51 | } else {
52 | return [_fileManager createFileAtPath:filePath
53 | contents:nil
54 | attributes:nil];
55 | }
56 | }
57 |
58 | /**
59 | * @brief 创建文件夹
60 | */
61 | - (BOOL)createDirectoryAtPath:(NSString *)path
62 | {
63 | if ( [self fileExistsAtPath:path] ) {
64 | return YES;
65 | } else {
66 | return [_fileManager createDirectoryAtPath:path
67 | withIntermediateDirectories:NO
68 | attributes:nil
69 | error:nil];
70 | }
71 | }
72 |
73 | /**
74 | * @brief 移除文件
75 | */
76 | - (BOOL)removeFileAtPath:(NSString *)filePath
77 | {
78 | if ( [self fileExistsAtPath:filePath] ) {
79 | return [_fileManager removeItemAtPath:filePath
80 | error:nil];
81 | } else {
82 | return YES;
83 | }
84 | }
85 |
86 | #pragma mark - 文件读取/保存
87 |
88 | /**
89 | * @brief 读取文件数据
90 | */
91 | - (NSData *)dataWithFilePath:(NSString *)filePath
92 | {
93 | if ( [self fileExistsAtPath:filePath] ) {
94 | return [NSData dataWithContentsOfFile:filePath];
95 | } else {
96 | return nil;
97 | }
98 | }
99 |
100 | /**
101 | * @brief 保存数据到文件
102 | */
103 | - (BOOL)saveData:(NSData *)data toFilePath:(NSString *)filePath
104 | {
105 | if ( [self fileExistsAtPath:filePath] ) {
106 | return [data writeToFile:filePath atomically:YES];
107 | } else {
108 | if ( [self createFileAtPath:filePath] ) {
109 | return [data writeToFile:filePath atomically:YES];
110 | } else {
111 | return NO;
112 | }
113 | }
114 | }
115 |
116 | /**
117 | * @brief 从文件读取键值对
118 | */
119 | - (NSDictionary *)dictionaryWithFilePath:(NSString *)filePath
120 | {
121 | if ( [self fileExistsAtPath:filePath] ) {
122 | return [NSDictionary dictionaryWithContentsOfFile:filePath];
123 | } else {
124 | return nil;
125 | }
126 | }
127 |
128 | /**
129 | * @brief 保存键值对到文件
130 | */
131 | - (BOOL)saveDictionary:(NSDictionary *)data toFilePath:(NSString *)filePath
132 | {
133 | if ( [self fileExistsAtPath:filePath] ) {
134 | return [data writeToFile:filePath atomically:YES];
135 | } else {
136 | if ( [self createFileAtPath:filePath] ) {
137 | return [data writeToFile:filePath atomically:YES];
138 | } else {
139 | return NO;
140 | }
141 | }
142 | }
143 |
144 | /**
145 | * @brief 从文件读取数组数据
146 | */
147 | - (NSArray *)arrayWithFilePath:(NSString *)filePath
148 | {
149 | if ( [self fileExistsAtPath:filePath] ) {
150 | return [NSArray arrayWithContentsOfFile:filePath];
151 | } else {
152 | return nil;
153 | }
154 | }
155 |
156 | /**
157 | * @brief 保存数组数据到文件
158 | */
159 | - (BOOL)saveArray:(NSArray *)data toFilePath:(NSString *)filePath
160 | {
161 | if ( [self fileExistsAtPath:filePath] ) {
162 | return [data writeToFile:filePath atomically:YES];
163 | } else {
164 | if ( [self createFileAtPath:filePath] ) {
165 | return [data writeToFile:filePath atomically:YES];
166 | } else {
167 | return NO;
168 | }
169 | }
170 | }
171 |
172 | @end
173 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Manager/ImagePickerManager/SCImagePickerManager.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCImagePickerManager.h
3 | // ZhongTouBang
4 | //
5 | // Created by Angzn on 7/8/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | /**
12 | * 图片选择完成操作
13 | *
14 | * @param picker 图片选择器
15 | * @param result 图片/视频路径
16 | * @param info Media信息
17 | */
18 | typedef void(^SCImagePickerDidFinishPickingMediaHandler)(UIImagePickerController *picker,
19 | id result,
20 | NSDictionary *info);
21 | /**
22 | * 图片选择取消操作
23 | *
24 | * @param picker 图片选择器
25 | */
26 | typedef void(^SCImagePickerDidCancelHandler)(UIImagePickerController *picker);
27 | /**
28 | * 图片选择器配置操作
29 | *
30 | * @param picker 图片选择器
31 | */
32 | typedef void(^SCImagePickerConfigHandler)(UIImagePickerController *picker);
33 |
34 | /**
35 | * @brief 保存图片到相册完成回调
36 | */
37 | typedef void(^SCImageDidSavedCompletionHandler)(NSError *error);
38 |
39 | /**
40 | * @brief 保存视频到相册完成回调
41 | */
42 | typedef void(^SCVideoDidSavedCompletionHandler)(NSError *error);
43 |
44 | @interface SCImagePickerManager : NSObject
45 |
46 | @property (nonatomic, assign) BOOL allowStore;
47 |
48 | @property (nonatomic, assign) BOOL onlyPhotoLibrary;
49 |
50 | @property (nonatomic, assign) BOOL onlyCamera;
51 |
52 | + (SCImagePickerManager *)sharedInstance;
53 |
54 | + (void)checkAccessForAssetsLibrary:(void (^)(BOOL granted))completionHandler;
55 |
56 | + (void)checkAccessForCamera:(void (^)(BOOL granted))completionHandler;
57 |
58 | - (void)startPickFromViewController:(UIViewController *)viewController
59 | configPicker:(SCImagePickerConfigHandler)configHandler
60 | didFinishPickingMedia:(SCImagePickerDidFinishPickingMediaHandler)pickingMediaHandler
61 | didCancel:(SCImagePickerDidCancelHandler)cancelHandler;
62 |
63 | - (void)saveImageToPhotosAlbum:(UIImage *)image
64 | completion:(SCImageDidSavedCompletionHandler)completion;
65 |
66 | - (void)saveVideoToPhotosAlbum:(NSString *)videoPath
67 | completion:(SCVideoDidSavedCompletionHandler)completion;
68 |
69 | @end
70 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Manager/LocationManager/SCLocationManager.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCLocationManager.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 14/10/20.
6 | // Copyright (c) 2014年 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | /**
13 | * TODO:
14 | * iOS8及以上使用位置服务需要在Info.plist文件中
15 | * NSLocationWhenInUseUsageDescription &
16 | * NSLocationAlwaysUsageDescription
17 | * 两个字段, 值可以为空.
18 | */
19 |
20 | /**
21 | * 位置访问权限认证类型
22 | */
23 | typedef NS_ENUM(NSUInteger, CLLocationManagerAuthorizationType) {
24 | /**
25 | * 使用期间使用位置
26 | */
27 | CLLocationManagerAuthorizationTypeWhenInUse,
28 | /**
29 | * 始终使用位置
30 | */
31 | CLLocationManagerAuthorizationTypeAlways,
32 | } NS_ENUM_AVAILABLE_IOS(8_0);
33 |
34 | @interface CLLocationManager (SCLocationManager)
35 |
36 | /**
37 | * @brief 位置访问权限认证类型
38 | *
39 | * Discussion:
40 | * By default, CLLocationManagerAuthorizationTypeWhenInUse is used.
41 | */
42 | @property (nonatomic) CLLocationManagerAuthorizationType authorizationType NS_AVAILABLE_IOS(8_0);
43 |
44 | @end
45 |
46 |
47 | /**
48 | * @brief 定位完成操作
49 | *
50 | * @param locations 位置数组
51 | */
52 | typedef void(^SCLocationManagerDidUpdateHandler)(NSArray *locations);
53 |
54 | /**
55 | * @brief 定位失败操作
56 | *
57 | * @param error 错误信息
58 | */
59 | typedef void(^SCLocationManagerDidFailHandler)(NSError *error);
60 |
61 | /**
62 | * @brief 定位配置操作
63 | *
64 | * @param manager 定位管理类
65 | */
66 | typedef void(^SCLocationManagerConfigHandler)(CLLocationManager *manager);
67 |
68 | @interface SCLocationManager : NSObject
69 |
70 | /**
71 | * @brief 定位完成时停止更新位置
72 | *
73 | * Discussion:
74 | * By default, YES.
75 | */
76 | @property (nonatomic, assign) BOOL stopWhenDidUpdate;
77 |
78 | /**
79 | * @brief 定位失败时停止更新位置
80 | *
81 | * Discussion:
82 | * By default, YES.
83 | */
84 | @property (nonatomic, assign) BOOL stopWhenDidFail;
85 |
86 | /**
87 | * @brief 定位失败时显示提示警告
88 | *
89 | * Discussion:
90 | * By default, YES.
91 | */
92 | @property (nonatomic, assign) BOOL alertWhenDidFail;
93 |
94 | + (SCLocationManager *)sharedInstance;
95 |
96 | - (void)startLocateWithConfig:(SCLocationManagerConfigHandler)configHandler
97 | didUpdate:(SCLocationManagerDidUpdateHandler)didUpdateHandler
98 | didFail:(SCLocationManagerDidFailHandler)didFailHandler;
99 |
100 | @end
101 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Manager/UserDefaultManager/SCUserDefaultManager.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCUserDefaultManager.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/6/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @class SCModel;
12 |
13 | @interface SCUserDefaultManager : NSObject
14 |
15 | + (SCUserDefaultManager *)sharedInstance;
16 |
17 | - (BOOL)getBoolForKey:(NSString *)key;
18 | - (NSInteger)getIntegerForKey:(NSString *)key;
19 | - (id)getObjectForKey:(NSString *)key;
20 | - (NSString *)getStringForKey:(NSString *)key;
21 | - (NSArray *)getArrayForKey:(NSString *)key;
22 | - (NSDictionary *)getDictionaryForKey:(NSString *)key;
23 | - (NSData *)getDataForKey:(NSString *)key;
24 | - (float)getFloatForKey:(NSString *)key;
25 | - (double)getDoubleForKey:(NSString *)key;
26 | - (NSURL *)getURLForKey:(NSString *)key;
27 | - (SCModel *)getModelForKey:(NSString *)key;
28 |
29 | - (void)setBool:(BOOL)bValue forKey:(NSString *)key;
30 | - (void)setInteger:(NSInteger)iVaule forKey:(NSString *)key;
31 | - (void)setObject:(id)objValue forKey:(NSString *)key;
32 | - (void)setFloat:(float)fValue forKey:(NSString *)key;
33 | - (void)setDouble:(double)dValue forKey:(NSString *)key;
34 | - (void)setURL:(NSURL *)url forKey:(NSString *)key;
35 | - (void)setModel:(SCModel *)model forKey:(NSString *)key;
36 |
37 | - (void)removeObjectForKey:(NSString *)key;
38 |
39 | @end
40 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Manager/UserDefaultManager/SCUserDefaultManager.m:
--------------------------------------------------------------------------------
1 | //
2 | // SCUserDefaultManager.m
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/6/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCUserDefaultManager.h"
10 | #import "SCSingleton.h"
11 |
12 | @interface SCUserDefaultManager ()
13 |
14 | @property (nonatomic, weak) NSUserDefaults *userDefaults;
15 |
16 | @end
17 |
18 |
19 | @implementation SCUserDefaultManager
20 |
21 | SCSINGLETON(SCUserDefaultManager);
22 |
23 | - (id)init
24 | {
25 | self = [super init];
26 | if (self) {
27 | _userDefaults = [NSUserDefaults standardUserDefaults];
28 | }
29 | return self;
30 | }
31 |
32 | #pragma mark - Get Methods
33 |
34 | - (BOOL)getBoolForKey:(NSString *)key
35 | {
36 | return [_userDefaults boolForKey:key];
37 | }
38 |
39 | - (NSInteger)getIntegerForKey:(NSString *)key
40 | {
41 | return [_userDefaults integerForKey:key];
42 | }
43 |
44 | - (id)getObjectForKey:(NSString *)key
45 | {
46 | return [_userDefaults objectForKey:key];
47 | }
48 |
49 | - (NSString *)getStringForKey:(NSString *)key
50 | {
51 | return [_userDefaults stringForKey:key];
52 | }
53 |
54 | - (NSArray *)getArrayForKey:(NSString *)key
55 | {
56 | return [_userDefaults arrayForKey:key];
57 | }
58 |
59 | - (NSDictionary *)getDictionaryForKey:(NSString *)key
60 | {
61 | return [_userDefaults dictionaryForKey:key];
62 | }
63 |
64 | - (NSData *)getDataForKey:(NSString *)key
65 | {
66 | return [_userDefaults dataForKey:key];
67 | }
68 |
69 | - (float)getFloatForKey:(NSString *)key
70 | {
71 | return [_userDefaults floatForKey:key];
72 | }
73 |
74 | - (double)getDoubleForKey:(NSString *)key
75 | {
76 | return [_userDefaults doubleForKey:key];
77 | }
78 |
79 | - (NSURL *)getURLForKey:(NSString *)key
80 | {
81 | return [_userDefaults URLForKey:key];
82 | }
83 |
84 | - (SCModel *)getModelForKey:(NSString *)key
85 | {
86 | NSData *data = [_userDefaults objectForKey:key];
87 | return [NSKeyedUnarchiver unarchiveObjectWithData:data];
88 | }
89 |
90 | #pragma mark - Set Methods
91 |
92 | - (void)setBool:(BOOL)bValue forKey:(NSString *)key
93 | {
94 | [_userDefaults setBool:bValue forKey:key];
95 | [_userDefaults synchronize];
96 | }
97 |
98 | - (void)setInteger:(NSInteger)iVaule forKey:(NSString *)key
99 | {
100 | [_userDefaults setInteger:iVaule forKey:key];
101 | [_userDefaults synchronize];
102 | }
103 |
104 | - (void)setObject:(id)objValue forKey:(NSString *)key
105 | {
106 | [_userDefaults setObject:objValue forKey:key];
107 | [_userDefaults synchronize];
108 | }
109 |
110 | - (void)setFloat:(float)fValue forKey:(NSString *)key
111 | {
112 | [_userDefaults setFloat:fValue forKey:key];
113 | [_userDefaults synchronize];
114 | }
115 |
116 | - (void)setDouble:(double)dValue forKey:(NSString *)key
117 | {
118 | [_userDefaults setDouble:dValue forKey:key];
119 | [_userDefaults synchronize];
120 | }
121 |
122 | - (void)setURL:(NSURL *)url forKey:(NSString *)key
123 | {
124 | [_userDefaults setURL:url forKey:key];
125 | [_userDefaults synchronize];
126 | }
127 |
128 | - (void)setModel:(SCModel *)model forKey:(NSString *)key
129 | {
130 | NSData *data = [NSKeyedArchiver archivedDataWithRootObject:model];
131 | [_userDefaults setObject:data forKey:key];
132 | [_userDefaults synchronize];
133 | }
134 |
135 | #pragma mark - Remove Methods
136 |
137 | - (void)removeObjectForKey:(NSString *)key
138 | {
139 | [_userDefaults removeObjectForKey:key];
140 | [_userDefaults synchronize];
141 | }
142 |
143 | @end
144 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Manager/VersionManager/SCVersionManager.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCVersionManager.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 7/15/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | extern NSString * const SCVersionManagerLanguageEnglish;
12 | extern NSString * const SCVersionManagerLanguageChineseSimplified;
13 | extern NSString * const SCVersionManagerLanguageChineseTraditional;
14 |
15 | typedef NS_ENUM(NSUInteger, SCVersionAlertType) {
16 | SCVersionAlertTypeDefault,
17 | SCVersionAlertTypeSkip,
18 | SCVersionAlertTypeForce,
19 | };
20 |
21 | @protocol SCVersionManagerDelegate
22 |
23 | @optional
24 | - (void)versionManagerDidPresentAlert;
25 | - (void)versionManagerDidLaunchAppStore;
26 | - (void)versionManagerDidSkipVersion;
27 | - (void)versionManagerDidCancel;
28 |
29 | @end
30 |
31 | @interface SCVersionManager : NSObject
32 |
33 | @property (nonatomic, weak ) id delegate;
34 |
35 | @property (nonatomic, copy ) NSString *appID;
36 |
37 | @property (nonatomic, copy ) NSString *appName;
38 |
39 | @property (nonatomic, copy ) NSString *countryCode;
40 |
41 | @property (nonatomic, assign) SCVersionAlertType alertType;
42 |
43 | + (SCVersionManager *)sharedInstance;
44 |
45 | - (void)checkVersion;
46 |
47 | - (void)checkVersionDaily;
48 |
49 | - (void)checkVersionWeekly;
50 |
51 | @end
52 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/SCConfig.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCConfig.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/4/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #ifndef SCFramework_SCConfig_h
10 | #define SCFramework_SCConfig_h
11 |
12 | // iPhone Device
13 | #if TARGET_OS_IPHONE
14 | #endif
15 |
16 | // iPhone Simulator
17 | #if TARGET_IPHONE_SIMULATOR
18 | #endif
19 |
20 | // ARC
21 | #if __has_feature(objc_arc)
22 | #endif
23 |
24 | // MRC
25 | #if ! __has_feature(objc_arc)
26 | #endif
27 |
28 | // 64-bit
29 | #if __LP64__
30 | #endif
31 |
32 | // -------------------------- 编译器 -------------------------- //
33 | #if !__has_feature(objc_arc)
34 | #error SCFramework is ARC only. Either turn on ARC for the project or use -fobjc-arc flag
35 | #endif
36 |
37 | #if __LP64__
38 | #define NSI "%ld"
39 | #define NSU "%lu"
40 | #define CGF "%lf"
41 | #else
42 | #define NSI "%d"
43 | #define NSU "%u"
44 | #define CGF "%f"
45 | #endif
46 |
47 | // -------------------------- 内存管理 -------------------------- //
48 | #if __has_feature(objc_arc)
49 | #if DEBUG
50 | #define SCRelease(obj)
51 | #else
52 | #define SCRelease(obj) obj = nil
53 | #endif
54 | #define SCSafeRelease(obj) obj = nil
55 | #else
56 | #if DEBUG
57 | #define SCRelease(obj) [obj release]
58 | #else
59 | #define SCRelease(obj) [obj release], obj = nil
60 | #endif
61 | #define SCSafeRelease(obj) [obj release], obj = nil
62 | #endif
63 |
64 | #endif
65 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/SCFramework.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCFramework.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/4/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #ifndef SCFramework_SCFramework_h
10 | #define SCFramework_SCFramework_h
11 |
12 | #import "SCConfig.h"
13 | #import "SCLog.h"
14 | #import "SCMacro.h"
15 | #import "SCSingleton.h"
16 |
17 | // -------------------------- Constant -------------------------- //
18 | #import "SCConstant.h"
19 |
20 | // -------------------------- Common -------------------------- //
21 | #import "SCUtils.h"
22 | #import "SCApp.h"
23 | #import "SCMath.h"
24 | #import "SCModel.h"
25 | #import "SCNSJSONSerialization.h"
26 |
27 | // -------------------------- Adapted -------------------------- //
28 | #import "SCAdaptedDevice.h"
29 | #import "SCAdaptedSystem.h"
30 |
31 | // -------------------------- Manager -------------------------- //
32 | #import "SCDateManager.h"
33 | #import "SCFileManager.h"
34 | #import "SCUserDefaultManager.h"
35 |
36 | // -------------------------- Category -------------------------- //
37 | #import "NSArray+SCAddition.h"
38 | #import "NSData+SCAddition.h"
39 | #import "NSDate+SCAddition.h"
40 | #import "NSDictionary+SCAddition.h"
41 | #import "NSObject+SCAddition.h"
42 | #import "NSString+SCAddition.h"
43 | #import "UIAlertView+SCAddition.h"
44 | #import "UIColor+SCAddition.h"
45 | #import "UIDevice+SCAddition.h"
46 | #import "UIImage+SCAddition.h"
47 | #import "UIView+SCAddition.h"
48 | #import "NSURL+SCAddition.h"
49 | #import "UIScreen+SCAddition.h"
50 | #import "NSTimer+SCAddition.h"
51 | #import "UITableView+SCAddition.h"
52 | #import "UIBarButtonItem+SCAddition.h"
53 | #import "UINavigationItem+SCAddition.h"
54 | #import "UINavigationController+SCAddition.h"
55 |
56 | // -------------------------- Veiw -------------------------- //
57 | #import "SCButton.h"
58 | #import "SCDatePicker.h"
59 | #import "SCLabel.h"
60 | #import "SCPickerView.h"
61 | #import "SCScrollView.h"
62 | #import "SCTableView.h"
63 | #import "SCTextField.h"
64 | #import "SCTextView.h"
65 | #import "SCView.h"
66 | #import "SCPageControl.h"
67 | #import "SCToolbar.h"
68 | #import "SCAlertView.h"
69 | #import "SCActionSheet.h"
70 |
71 | // -------------------------- VeiwController -------------------------- //
72 | #import "SCViewController.h"
73 | #import "SCTableViewController.h"
74 | #import "SCNavigationController.h"
75 | #import "SCCTNavigationController.h"
76 | #import "SCDBNavigationController.h"
77 | #import "SCTabBarController.h"
78 |
79 | #endif
80 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/SCLog.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCLog.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/4/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #ifndef SCFramework_SCLog_h
10 | #define SCFramework_SCLog_h
11 |
12 | //*
13 |
14 | #define DEBUG_LOG_PREFIX @"< %@:[Line %d] %s >\n"
15 | #define DEBUG_LOG_FILENAME [[NSString stringWithUTF8String:__FILE__] lastPathComponent]
16 |
17 | // Only display output when the DEBUG setting
18 | #ifdef DEBUG
19 | #define DLog(frmt, ...) { NSLog(DEBUG_LOG_PREFIX frmt, \
20 | DEBUG_LOG_FILENAME, \
21 | __LINE__, __FUNCTION__, \
22 | ##__VA_ARGS__); }
23 | #define DRedLog(frmt, ...) { NSLog(DEBUG_LOG_PREFIX frmt, \
24 | DEBUG_LOG_FILENAME, \
25 | __LINE__, __FUNCTION__, \
26 | ##__VA_ARGS__); }
27 | #define DBlueLog(frmt, ...) { NSLog(DEBUG_LOG_PREFIX frmt, \
28 | DEBUG_LOG_FILENAME, \
29 | __LINE__, __FUNCTION__, \
30 | ##__VA_ARGS__); }
31 | #define ELog(err) { if (err) DRedLog(@"%@", err); }
32 | #else
33 | #define DLog(frmt, ...)
34 | #define DRedLog(frmt, ...)
35 | #define DBlueLog(frmt, ...)
36 | #define ELog(err)
37 | #endif
38 |
39 | // ALog always displays output regardless of the DEBUG setting
40 | #ifndef ALog
41 | #define ALog(frmt, ...) { NSLog(DEBUG_LOG_PREFIX frmt, \
42 | DEBUG_LOG_FILENAME, \
43 | __LINE__, __FUNCTION__, \
44 | ##__VA_ARGS__); }
45 | #endif
46 |
47 | /*/
48 |
49 | //
50 | // Plugin : MCLog
51 | //
52 | #define __DLOG_FILE__ [[NSString stringWithUTF8String:__FILE__] lastPathComponent]
53 |
54 | #define __DLog(LEVEL, fmt, ...) NSLog((@"-\e[7m" LEVEL @" [\e[27;2;3;4m < %@:[Line %d] %s > \e[22;23;24m] " fmt), \
55 | __DLOG_FILE__, __LINE__, __PRETTY_FUNCTION__, ##__VA_ARGS__)
56 |
57 | // Only display output when the DEBUG setting
58 | #ifdef DEBUG
59 | #define DLogV(fmt, ...) __DLog(@"[VERBOSE]", fmt, ##__VA_ARGS__)
60 | #define DLogI(fmt, ...) __DLog(@"[INFO]", fmt, ##__VA_ARGS__)
61 | #define DLogW(fmt, ...) __DLog(@"[WARN]", fmt, ##__VA_ARGS__)
62 | #define DLogE(fmt, ...) __DLog(@"[ERROR]", fmt, ##__VA_ARGS__)
63 |
64 | #define DLog(fmt, ...) { DLogI(fmt, ##__VA_ARGS__); }
65 | #define DRedLog(fmt, ...) { DLogE(fmt, ##__VA_ARGS__); }
66 | #define DBlueLog(fmt, ...) { DLogV(fmt, ##__VA_ARGS__); }
67 | #define ELog(err) { if (err) DRedLog(@"%@", err); }
68 | #else
69 | #define DLogV(fmt, ...)
70 | #define DLogI(fmt, ...)
71 | #define DLogW(fmt, ...)
72 | #define DLogE(fmt, ...)
73 |
74 | #define DLog(fmt, ...)
75 | #define DRedLog(fmt, ...)
76 | #define DBlueLog(fmt, ...)
77 | #define ELog(err)
78 | #endif
79 |
80 | // ALog always displays output regardless of the DEBUG setting
81 | #ifndef ALog
82 | #define ALog(fmt, ...) __DLog(@"[ALWAY]", fmt, ##__VA_ARGS__)
83 | #endif
84 |
85 | //*/
86 |
87 | #endif
88 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/SCMacro.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCMacro.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/4/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #ifndef SCFramework_SCMacro_h
10 | #define SCFramework_SCMacro_h
11 |
12 | // -------------------------- OS -------------------------- //
13 | #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000
14 | #define kSC_iOS7_OR_LATER ([[[UIDevice currentDevice] systemVersion] \
15 | compare:@"7.0"] != NSOrderedAscending)
16 | #else
17 | #define kSC_iOS7_OR_LATER (NO)
18 | #endif
19 |
20 | #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
21 | #define kSC_iOS8_OR_LATER ([[[UIDevice currentDevice] systemVersion] \
22 | compare:@"8.0"] != NSOrderedAscending)
23 | #else
24 | #define kSC_iOS8_OR_LATER (NO)
25 | #endif
26 |
27 | #define kSC_iPhoneX ([[UIScreen mainScreen] bounds].size.width == 375.0 && \
28 | [[UIScreen mainScreen] bounds].size.height == 812.0 ? YES : NO)
29 |
30 | #define kSC_iPhoneX_OR_LATER ((([[UIScreen mainScreen] bounds].size.width == 375.0 && \
31 | [[UIScreen mainScreen] bounds].size.height == 812.0) || \
32 | ([[UIScreen mainScreen] bounds].size.width == 414.0 && \
33 | [[UIScreen mainScreen] bounds].size.height == 896.0)) ? YES : NO)
34 |
35 | #define kSC_SYSTEM_VERSION_F ([[[UIDevice currentDevice] systemVersion] floatValue])
36 | #define kSC_SYSTEM_VERSION_D ([[[UIDevice currentDevice] systemVersion] doubleValue])
37 | #define kSC_SYSTEM_VERSION_S ([[UIDevice currentDevice] systemVersion])
38 |
39 | #define kSC_CURRENT_LANGUAGE ([[NSLocale preferredLanguages] firstObject])
40 |
41 | #define kSC_iPad (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
42 | #define kSC_iPhone (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
43 |
44 | #define kSC_PORTRAIT (UIDeviceOrientationIsPortrait([UIDevice currentDevice].orientation))
45 | #define kSC_LANDSCAPE (UIDeviceOrientationIsLandscape([UIDevice currentDevice].orientation))
46 |
47 | // -------------------------- 常用宏常量 -------------------------- //
48 | #define kSC_KEY_WINDOW ([[UIApplication sharedApplication] keyWindow])
49 |
50 | #define kSC_MAIN_SCREEN_SCALE ([[UIScreen mainScreen] scale])
51 |
52 | #define kSC_APP_FRAME ([[UIScreen mainScreen] applicationFrame])
53 | #define kSC_APP_FRAME_HEIGHT ([[UIScreen mainScreen] applicationFrame].size.height)
54 | #define kSC_APP_FRAME_WIDTH ([[UIScreen mainScreen] applicationFrame].size.width)
55 |
56 | #define kSC_MAIN_SCREEN_HEIGHT ([[UIScreen mainScreen] bounds].size.height)
57 | #define kSC_MAIN_SCREEN_WIDTH ([[UIScreen mainScreen] bounds].size.width)
58 |
59 | #define kSC_APP_TEMPORARY_DIRECTORY NSTemporaryDirectory()
60 | #define kSC_APP_CACHES_DIRECTORY NSSearchPathForDirectoriesInDomains(NSCachesDirectory, \
61 | NSUserDomainMask, \
62 | YES)
63 | #define kSC_APP_DOCUMENT_DIRECTORY NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, \
64 | NSUserDomainMask, \
65 | YES)
66 |
67 | // -------------------------- 常用宏方法 -------------------------- //
68 | #define kSCPNGPATH(NAME) [[NSBundle mainBundle] pathForResource:(NAME) ofType:@"png"]
69 | #define kSCJPGPATH(NAME) [[NSBundle mainBundle] pathForResource:(NAME) ofType:@"jpg"]
70 | #define kSCPATH(NAME, EXT) [[NSBundle mainBundle] pathForResource:(NAME) ofType:(EXT)]
71 |
72 | #define kSCPNGIMAGE(NAME) [UIImage imageWithContentsOfFile:\
73 | [[NSBundle mainBundle] pathForResource:(NAME) ofType:@"png"]]
74 | #define kSCJPGIMAGE(NAME) [UIImage imageWithContentsOfFile:\
75 | [[NSBundle mainBundle] pathForResource:(NAME) ofType:@"jpg"]]
76 | #define kSCIMAGE(NAME, EXT) [UIImage imageWithContentsOfFile:\
77 | [[NSBundle mainBundle] pathForResource:(NAME) ofType:(EXT)]]
78 |
79 | #define kSCBOLDSYSTEMFONT(FONTSIZE) [UIFont boldSystemFontOfSize:FONTSIZE]
80 | #define kSCSYSTEMFONT(FONTSIZE) [UIFont systemFontOfSize:FONTSIZE]
81 | #define kSCFONT(NAME, FONTSIZE) [UIFont fontWithName:(NAME) size:(FONTSIZE)]
82 |
83 | #define kSCSTRINGFROMENUM(ENUMVALUE) (@#ENUMVALUE)
84 |
85 | #define kSCPROPERTYFULLKEYPATH(PROPERTY) (@#PROPERTY)
86 |
87 | #define kSCPROPERTYKEYPATH(PROPERTY) ([[(@#PROPERTY) componentsSeparatedByString:@"."] lastObject])
88 |
89 | #endif
90 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/ViewControllers/SCNavigationController/SCCTNavigationController.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCCTNavigationController.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 5/12/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCNavigationController.h"
10 |
11 | #if __IPHONE_OS_VERSION_MIN_REQUIRED < 70000
12 | #warning 该导航控制器只支持iOS7及以上SDK
13 | #endif
14 |
15 | #import "SCViewControllerTransition.h"
16 | #import "SCCTNavigationControllerDelegateManager.h"
17 |
18 | /**
19 | * 自定义返回手势及转场动画导航控制器类(iOS7+), 使用iOS7的转场动画实现
20 | */
21 | @interface SCCTNavigationController : SCNavigationController
22 | <
23 | SCViewControllerTransition
24 | >
25 |
26 | /// 手势交互是否可用, 默认为YES
27 | @property (assign, nonatomic) BOOL interactiveEnabled;
28 |
29 | /// 转场方向
30 | @property (assign, nonatomic) SCViewControllerTransitionDirection direction;
31 |
32 | /// 委托管理对象
33 | @property (strong, nonatomic) SCCTNavigationControllerDelegateManager *delegateManager;
34 |
35 | - (instancetype)initWithNavigationBarClass:(Class)navigationBarClass;
36 |
37 | @end
38 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/ViewControllers/SCNavigationController/SCCTNavigationControllerDelegateManager.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCCTNavigationControllerDelegateManager.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 5/13/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | /**
12 | * 导航控制器委托管理类
13 | */
14 | @interface SCCTNavigationControllerDelegateManager : NSObject
15 | <
16 | UINavigationControllerDelegate
17 | >
18 |
19 | /// 手势交互转场动画
20 | @property (strong, nonatomic) UIPercentDrivenInteractiveTransition *interactiveAnimator;
21 |
22 | @end
23 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/ViewControllers/SCNavigationController/SCCTNavigationControllerDelegateManager.m:
--------------------------------------------------------------------------------
1 | //
2 | // SCCTNavigationControllerDelegateManager.m
3 | // SCFramework
4 | //
5 | // Created by Angzn on 5/13/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCCTNavigationControllerDelegateManager.h"
10 |
11 | #import "SCViewControllerTransitionAnimator.h"
12 |
13 | @interface SCCTNavigationControllerDelegateManager ()
14 |
15 | /// 控制器转场动画
16 | @property (strong, nonatomic) SCViewControllerTransitionAnimator *transitionAnimator;
17 |
18 | @end
19 |
20 | @implementation SCCTNavigationControllerDelegateManager
21 |
22 | #pragma mark - Init Method
23 |
24 | - (instancetype)init
25 | {
26 | self = [super init];
27 | if (self) {
28 | _transitionAnimator = [[SCViewControllerTransitionAnimator alloc] init];
29 | }
30 | return self;
31 | }
32 |
33 | #pragma mark - UINavigationControllerDelegate
34 |
35 | - (id )navigationController:(UINavigationController *)navigationController
36 | interactionControllerForAnimationController:(id ) animationController
37 | {
38 | return _interactiveAnimator;
39 | }
40 |
41 | - (id )navigationController:(UINavigationController *)navigationController
42 | animationControllerForOperation:(UINavigationControllerOperation)operation
43 | fromViewController:(UIViewController *)fromVC
44 | toViewController:(UIViewController *)toVC
45 | {
46 | Class SCCTNavigationControllerClass = NSClassFromString(@"SCCTNavigationController");
47 | if ([navigationController isKindOfClass:SCCTNavigationControllerClass] ||
48 | [navigationController isMemberOfClass:SCCTNavigationControllerClass]) {
49 | if ([navigationController respondsToSelector:@selector(transitionDirection)]) {
50 | NSInteger directionValue;
51 | SEL selector = @selector(transitionDirection);
52 | NSMethodSignature *signature = [navigationController methodSignatureForSelector:selector];
53 | NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
54 | invocation.target = navigationController;
55 | invocation.selector = selector;
56 | [invocation invoke];
57 | [invocation getReturnValue:&directionValue];
58 | _transitionAnimator.direction = directionValue;
59 | }
60 | }
61 | _transitionAnimator.operation = (SCViewControllerTransitionOperation)operation;
62 | return _transitionAnimator;
63 | }
64 |
65 | @end
66 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/ViewControllers/SCNavigationController/SCDBNavigationController.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCDBNavigationController.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 5/14/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCNavigationController.h"
10 |
11 | typedef NS_ENUM(NSInteger, SCDBNavigationControllerInteractiveDragMode) {
12 | SCDBNavigationControllerInteractiveDragModeFadeOut,//淡出
13 | SCDBNavigationControllerInteractiveDragModeComeUp,//上浮
14 | };
15 |
16 | /**
17 | * 拖动返回导航控制器类
18 | *
19 | * 在导航视图底部插入上一屏幕截图, 导航视图随拖动右移,
20 | * 手势结束时, 判断是否满足返回条件,
21 | * 满足条件, 完成返回; 反之.
22 | */
23 | @interface SCDBNavigationController : SCNavigationController
24 |
25 | /// 是否可以拖动返回, 默认为YES
26 | @property (nonatomic, assign) BOOL canDragBack;
27 |
28 | /// 交互拖动模式, 默认为FadeOut
29 | @property (nonatomic, assign) SCDBNavigationControllerInteractiveDragMode interactiveMode;
30 |
31 | - (instancetype)initWithNavigationBarClass:(Class)navigationBarClass;
32 |
33 | @end
34 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/ViewControllers/SCNavigationController/SCNavigationController.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCNavigationController.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/10/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface SCNavigationController : UINavigationController
12 |
13 | /// 手势交互是否可用, 默认为YES
14 | @property (assign, nonatomic) BOOL interactivePopEnabled;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/ViewControllers/SCNavigationController/SCNavigationController.m:
--------------------------------------------------------------------------------
1 | //
2 | // SCNavigationController.m
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/10/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCNavigationController.h"
10 | #import "UINavigationController+SCAddition.h"
11 |
12 | @interface SCNavigationController ()
13 | <
14 | UINavigationControllerDelegate,
15 | UIGestureRecognizerDelegate
16 | >
17 | @end
18 |
19 | @implementation SCNavigationController
20 |
21 | - (void)viewDidLoad
22 | {
23 | [super viewDidLoad];
24 | // Do any additional setup after loading the view.
25 |
26 | self.view.backgroundColor = [UIColor whiteColor];
27 |
28 | self.interactivePopEnabled = YES;
29 | }
30 |
31 | - (void)didReceiveMemoryWarning
32 | {
33 | [super didReceiveMemoryWarning];
34 | // Dispose of any resources that can be recreated.
35 | }
36 |
37 | #pragma mark - Override Method
38 |
39 | - (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
40 | {
41 | // Hijack the push method to disable the gesture
42 | if ([self respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
43 | self.interactivePopGestureRecognizer.enabled = NO;
44 | }
45 |
46 | [super pushViewController:viewController animated:animated];
47 | }
48 |
49 | #pragma mark - UINavigationControllerDelegate
50 |
51 | - (void)navigationController:(UINavigationController *)navigationController
52 | didShowViewController:(UIViewController *)viewController
53 | animated:(BOOL)animate
54 | {
55 | if ([navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
56 | if ([navigationController isOnlyContainRootViewController]) {
57 | // Disable the interactive pop gesture in the rootViewController of navigationController
58 | navigationController.interactivePopGestureRecognizer.enabled = NO;
59 | } else {
60 | // Enable the interactive pop gesture
61 | navigationController.interactivePopGestureRecognizer.enabled = YES;
62 | }
63 | }
64 | }
65 |
66 | #pragma mark - Public Method
67 |
68 | - (BOOL)interactivePopEnabled
69 | {
70 | if ([self respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
71 | return self.interactivePopGestureRecognizer.enabled;
72 | } else {
73 | return NO;
74 | }
75 | }
76 |
77 | - (void)setInteractivePopEnabled:(BOOL)interactivePopEnabled
78 | {
79 | if ([self respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
80 | if (interactivePopEnabled) {
81 | self.interactivePopGestureRecognizer.delegate = self;
82 | self.delegate = self;
83 | } else {
84 | self.interactivePopGestureRecognizer.delegate = nil;
85 | self.delegate = nil;
86 | }
87 | self.interactivePopGestureRecognizer.enabled = interactivePopEnabled;
88 | }
89 | }
90 |
91 | @end
92 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/ViewControllers/SCNavigationController/SCViewControllerTransition.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCViewControllerTransition.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 5/13/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | // 转场方向
12 | typedef NS_ENUM(NSInteger, SCViewControllerTransitionDirection) {
13 | SCViewControllerTransitionDirectionHorizontal,
14 | SCViewControllerTransitionDirectionVertical,
15 | };
16 |
17 | // 转场动作
18 | typedef NS_ENUM(NSInteger, SCViewControllerTransitionOperation) {
19 | SCViewControllerTransitionOperationNone = UINavigationControllerOperationNone,
20 | SCViewControllerTransitionOperationPush = UINavigationControllerOperationPush,
21 | SCViewControllerTransitionOperationPop = UINavigationControllerOperationPop,
22 | };
23 |
24 | /**
25 | * 视图控制器转场协议
26 | */
27 | @protocol SCViewControllerTransition
28 |
29 | /**
30 | * @brief 转场方向
31 | */
32 | - (SCViewControllerTransitionDirection)transitionDirection;
33 |
34 | @end
35 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/ViewControllers/SCNavigationController/SCViewControllerTransitionAnimator.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCViewControllerTransitionAnimator.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 5/7/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #import "SCViewControllerTransition.h"
12 |
13 | /**
14 | * 视图控制器转场动画类
15 | */
16 | @interface SCViewControllerTransitionAnimator : NSObject
17 | <
18 | UIViewControllerAnimatedTransitioning
19 | >
20 |
21 | /// 转场动画时间
22 | @property (nonatomic) NSTimeInterval duration;
23 |
24 | /// 转场方向
25 | @property (nonatomic) SCViewControllerTransitionDirection direction;
26 |
27 | /// 转场动作
28 | @property (nonatomic) SCViewControllerTransitionOperation operation;
29 |
30 | @end
31 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/ViewControllers/SCPageViewController/SCPageViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCPageViewController.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 15/5/28.
6 | // Copyright (c) 2015年 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface SCPageViewController : UIPageViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/ViewControllers/SCPageViewController/SCPageViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // SCPageViewController.m
3 | // SCFramework
4 | //
5 | // Created by Angzn on 15/5/28.
6 | // Copyright (c) 2015年 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCPageViewController.h"
10 |
11 | @interface SCPageViewController ()
12 |
13 | @end
14 |
15 | @implementation SCPageViewController
16 |
17 | - (void)viewDidLoad
18 | {
19 | [super viewDidLoad];
20 | // Do any additional setup after loading the view.
21 |
22 | self.view.backgroundColor = [UIColor whiteColor];
23 | }
24 |
25 | - (void)didReceiveMemoryWarning
26 | {
27 | [super didReceiveMemoryWarning];
28 | // Dispose of any resources that can be recreated.
29 | }
30 |
31 | @end
32 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/ViewControllers/SCTabBarController/SCTabBarController.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCTabBarController.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 4/30/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface SCTabBarController : UITabBarController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/ViewControllers/SCTabBarController/SCTabBarController.m:
--------------------------------------------------------------------------------
1 | //
2 | // SCTabBarController.m
3 | // SCFramework
4 | //
5 | // Created by Angzn on 4/30/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCTabBarController.h"
10 |
11 | @interface SCTabBarController ()
12 |
13 | @end
14 |
15 | @implementation SCTabBarController
16 |
17 | - (void)viewDidLoad
18 | {
19 | [super viewDidLoad];
20 | // Do any additional setup after loading the view.
21 |
22 | self.view.backgroundColor = [UIColor whiteColor];
23 | }
24 |
25 | - (void)didReceiveMemoryWarning
26 | {
27 | [super didReceiveMemoryWarning];
28 | // Dispose of any resources that can be recreated.
29 | }
30 |
31 | @end
32 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/ViewControllers/SCTableViewController/SCTableViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCTableViewController.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/10/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCViewController.h"
10 | #import "SCTableView.h"
11 |
12 | @interface SCTableViewController : SCViewController
13 | <
14 | UITableViewDataSource,
15 | UITableViewDelegate,
16 | SCTableViewPullDelegate
17 | >
18 |
19 | @property (nonatomic, strong) SCTableView *tableView;
20 |
21 | + (UITableViewStyle)tableViewStyle;
22 |
23 | - (id)initWithStyle:(UITableViewStyle)style;
24 |
25 | @end
26 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/ViewControllers/SCTableViewController/SCTableViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // SCTableViewController.m
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/10/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCTableViewController.h"
10 | #import "SCTableViewCell.h"
11 |
12 | @interface SCTableViewController ()
13 |
14 | @property (nonatomic) UITableViewStyle style;
15 |
16 | @end
17 |
18 | @implementation SCTableViewController
19 |
20 | - (void)dealloc
21 | {
22 | _tableView.dataSource = nil;
23 | _tableView.delegate = nil;
24 | _tableView.pullDelegate = nil;
25 | }
26 |
27 | #pragma mark - Init Methods
28 |
29 | + (UITableViewStyle)tableViewStyle
30 | {
31 | return UITableViewStylePlain;
32 | }
33 |
34 | - (id)init
35 | {
36 | self = [super init];
37 | if (self) {
38 | _style = [self.class tableViewStyle];
39 | }
40 | return self;
41 | }
42 |
43 | - (id)initWithStyle:(UITableViewStyle)style
44 | {
45 | self = [super init];
46 | if (self) {
47 | _style = style;
48 | }
49 | return self;
50 | }
51 |
52 | #pragma mark - View LifeCycle
53 |
54 | - (void)viewDidLoad
55 | {
56 | [super viewDidLoad];
57 | // Do any additional setup after loading the view.
58 |
59 | _tableView = [[SCTableView alloc] initWithFrame:self.view.bounds
60 | style:_style];
61 | _tableView.autoresizingMask = (UIViewAutoresizingFlexibleWidth |
62 | UIViewAutoresizingFlexibleHeight);
63 | _tableView.showsHorizontalScrollIndicator = NO;
64 | _tableView.showsVerticalScrollIndicator = NO;
65 | _tableView.dataSource = self;
66 | _tableView.delegate = self;
67 | _tableView.pullDelegate = self;
68 | [self.view addSubview:_tableView];
69 | }
70 |
71 | - (void)didReceiveMemoryWarning
72 | {
73 | [super didReceiveMemoryWarning];
74 | // Dispose of any resources that can be recreated.
75 | }
76 |
77 | #pragma mark - UITableViewDataSource & UITableViewDelegate
78 |
79 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
80 | {
81 | return 0;
82 | }
83 |
84 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
85 | {
86 | return 0;
87 | }
88 |
89 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
90 | {
91 | static NSString *cellIdentifier = @"Cell";
92 | SCTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
93 | if (!cell) {
94 | cell = [[SCTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
95 | reuseIdentifier:cellIdentifier];
96 | }
97 | return cell;
98 | }
99 |
100 | @end
101 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/ViewControllers/SCViewController/SCViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCViewController.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/10/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface SCViewController : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/ViewControllers/SCViewController/SCViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // SCViewController.m
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/10/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCViewController.h"
10 |
11 | @interface SCViewController ()
12 |
13 | @end
14 |
15 | @implementation SCViewController
16 |
17 | - (void)viewDidLoad
18 | {
19 | [super viewDidLoad];
20 | // Do any additional setup after loading the view.
21 |
22 | self.view.backgroundColor = [UIColor whiteColor];
23 | }
24 |
25 | - (void)didReceiveMemoryWarning
26 | {
27 | [super didReceiveMemoryWarning];
28 | // Dispose of any resources that can be recreated.
29 | }
30 |
31 | @end
32 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Views/SCActionSheet/SCActionSheet.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCActionSheet.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 14/12/8.
6 | // Copyright (c) 2014年 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | typedef void(^SCActionSheetClickedHandler)(UIActionSheet *actionSheet, NSInteger buttonIndex);
12 | typedef void(^SCActionSheetCancelHandler)(UIActionSheet *actionSheet);
13 | typedef void(^SCActionSheetWillPresentHandler)(UIActionSheet *actionSheet);
14 | typedef void(^SCActionSheetDidPresentHandler)(UIActionSheet *actionSheet);
15 | typedef void(^SCActionSheetWillDismissHandler)(UIActionSheet *actionSheet, NSInteger buttonIndex);
16 | typedef void(^SCActionSheetDidDismissHandler)(UIActionSheet *actionSheet, NSInteger buttonIndex);
17 |
18 | @interface SCActionSheet : UIActionSheet
19 |
20 | - (void)setClickedHandler:(SCActionSheetClickedHandler)clickedHandler;
21 | - (void)setCancelHandler:(SCActionSheetCancelHandler)cancelHandler;
22 | - (void)setWillPresentHandler:(SCActionSheetWillPresentHandler)willPresentHandler;
23 | - (void)setDidPresentHandler:(SCActionSheetDidPresentHandler)didPresentHandler;
24 | - (void)setWillDismissHandler:(SCActionSheetWillDismissHandler)willDismissHandler;
25 | - (void)setDidDismissHandler:(SCActionSheetDidDismissHandler)didDismissHandler;
26 |
27 | @end
28 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Views/SCActionSheet/SCActionSheet.m:
--------------------------------------------------------------------------------
1 | //
2 | // SCActionSheet.m
3 | // SCFramework
4 | //
5 | // Created by Angzn on 14/12/8.
6 | // Copyright (c) 2014年 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCActionSheet.h"
10 |
11 | @interface SCActionSheet ()
12 | <
13 | UIActionSheetDelegate
14 | >
15 |
16 | @property (nonatomic, copy) SCActionSheetClickedHandler clickedHandler;
17 | @property (nonatomic, copy) SCActionSheetCancelHandler cancelHandler;
18 | @property (nonatomic, copy) SCActionSheetWillPresentHandler willPresentHandler;
19 | @property (nonatomic, copy) SCActionSheetDidPresentHandler didPresentHandler;
20 | @property (nonatomic, copy) SCActionSheetWillDismissHandler willDismissHandler;
21 | @property (nonatomic, copy) SCActionSheetDidDismissHandler didDismissHandler;
22 |
23 | @end
24 |
25 | @implementation SCActionSheet
26 |
27 | #pragma mark - UIActionSheetDelegate
28 |
29 | - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
30 | {
31 | if (self.clickedHandler) {
32 | self.clickedHandler(actionSheet, buttonIndex);
33 | }
34 | }
35 |
36 | - (void)actionSheetCancel:(UIActionSheet *)actionSheet
37 | {
38 | if (self.cancelHandler) {
39 | self.cancelHandler(actionSheet);
40 | }
41 | }
42 |
43 | - (void)willPresentActionSheet:(UIActionSheet *)actionSheet
44 | {
45 | if (self.willPresentHandler) {
46 | self.willPresentHandler(actionSheet);
47 | }
48 | }
49 |
50 | - (void)didPresentActionSheet:(UIActionSheet *)actionSheet
51 | {
52 | if (self.didPresentHandler) {
53 | self.didPresentHandler(actionSheet);
54 | }
55 | }
56 |
57 | - (void)actionSheet:(UIActionSheet *)actionSheet willDismissWithButtonIndex:(NSInteger)buttonIndex
58 | {
59 | if (self.willDismissHandler) {
60 | self.willDismissHandler(actionSheet, buttonIndex);
61 | }
62 | }
63 |
64 | - (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex
65 | {
66 | if (self.didDismissHandler) {
67 | self.didDismissHandler(actionSheet, buttonIndex);
68 | }
69 | }
70 |
71 | #pragma mark - Public Method
72 |
73 | - (void)setClickedHandler:(SCActionSheetClickedHandler)clickedHandler
74 | {
75 | self.delegate = self;
76 |
77 | _clickedHandler = nil;
78 | _clickedHandler = [clickedHandler copy];
79 | }
80 |
81 | - (void)setCancelHandler:(SCActionSheetCancelHandler)cancelHandler
82 | {
83 | self.delegate = self;
84 |
85 | _cancelHandler = nil;
86 | _cancelHandler = [cancelHandler copy];
87 | }
88 |
89 | - (void)setWillPresentHandler:(SCActionSheetWillPresentHandler)willPresentHandler
90 | {
91 | self.delegate = self;
92 |
93 | _willPresentHandler = nil;
94 | _willPresentHandler = [willPresentHandler copy];
95 | }
96 |
97 | - (void)setDidPresentHandler:(SCActionSheetDidPresentHandler)didPresentHandler
98 | {
99 | self.delegate = self;
100 |
101 | _didPresentHandler = nil;
102 | _didPresentHandler = [didPresentHandler copy];
103 | }
104 |
105 | - (void)setWillDismissHandler:(SCActionSheetWillDismissHandler)willDismissHandler
106 | {
107 | self.delegate = self;
108 |
109 | _willDismissHandler = nil;
110 | _willDismissHandler = [willDismissHandler copy];
111 | }
112 |
113 | - (void)setDidDismissHandler:(SCActionSheetDidDismissHandler)didDismissHandler
114 | {
115 | self.delegate = self;
116 |
117 | _didDismissHandler = nil;
118 | _didDismissHandler = [didDismissHandler copy];
119 | }
120 |
121 | @end
122 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Views/SCAlertView/SCAlertView.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCAlertView.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 14/12/8.
6 | // Copyright (c) 2014年 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | typedef void(^SCAlertViewClickedHandler)(UIAlertView *alertView, NSInteger buttonIndex);
12 | typedef void(^SCAlertViewCancelHandler)(UIAlertView *alertView);
13 | typedef void(^SCAlertViewWillPresentHandler)(UIAlertView *alertView);
14 | typedef void(^SCAlertViewDidPresentHandler)(UIAlertView *alertView);
15 | typedef void(^SCAlertViewWillDismissHandler)(UIAlertView *alertView, NSInteger buttonIndex);
16 | typedef void(^SCAlertViewDidDismissHandler)(UIAlertView *alertView, NSInteger buttonIndex);
17 | typedef BOOL(^SCAlertViewShouldEnableHandler)(UIAlertView *alertView);
18 |
19 | @interface SCAlertView : UIAlertView
20 |
21 | - (void)setClickedHandler:(SCAlertViewClickedHandler)clickedHandler;
22 | - (void)setCancelHandler:(SCAlertViewCancelHandler)cancelHandler;
23 | - (void)setWillPresentHandler:(SCAlertViewWillPresentHandler)willPresentHandler;
24 | - (void)setDidPresentHandler:(SCAlertViewDidPresentHandler)didPresentHandler;
25 | - (void)setWillDismissHandler:(SCAlertViewWillDismissHandler)willDismissHandler;
26 | - (void)setDidDismissHandler:(SCAlertViewDidDismissHandler)didDismissHandler;
27 | - (void)setShouldEnableHandler:(SCAlertViewShouldEnableHandler)shouldEnableHandler;
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Views/SCAlertView/SCAlertView.m:
--------------------------------------------------------------------------------
1 | //
2 | // SCAlertView.m
3 | // SCFramework
4 | //
5 | // Created by Angzn on 14/12/8.
6 | // Copyright (c) 2014年 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCAlertView.h"
10 |
11 | @interface SCAlertView ()
12 | <
13 | UIAlertViewDelegate
14 | >
15 |
16 | @property (nonatomic, copy) SCAlertViewClickedHandler clickedHandler;
17 | @property (nonatomic, copy) SCAlertViewCancelHandler cancelHandler;
18 | @property (nonatomic, copy) SCAlertViewWillPresentHandler willPresentHandler;
19 | @property (nonatomic, copy) SCAlertViewDidPresentHandler didPresentHandler;
20 | @property (nonatomic, copy) SCAlertViewWillDismissHandler willDismissHandler;
21 | @property (nonatomic, copy) SCAlertViewDidDismissHandler didDismissHandler;
22 | @property (nonatomic, copy) SCAlertViewShouldEnableHandler shouldEnableHandler;
23 |
24 | @end
25 |
26 | @implementation SCAlertView
27 |
28 | #pragma mark - UIAlertViewDelegate
29 |
30 | - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
31 | {
32 | if (self.clickedHandler) {
33 | self.clickedHandler(alertView, buttonIndex);
34 | }
35 | }
36 |
37 | - (void)alertViewCancel:(UIAlertView *)alertView
38 | {
39 | if (self.cancelHandler) {
40 | self.cancelHandler(alertView);
41 | }
42 | }
43 |
44 | - (void)willPresentAlertView:(UIAlertView *)alertView
45 | {
46 | if (self.willPresentHandler) {
47 | self.willPresentHandler(alertView);
48 | }
49 | }
50 |
51 | - (void)didPresentAlertView:(UIAlertView *)alertView
52 | {
53 | if (self.didPresentHandler) {
54 | self.didPresentHandler(alertView);
55 | }
56 | }
57 |
58 | - (void)alertView:(UIAlertView *)alertView willDismissWithButtonIndex:(NSInteger)buttonIndex
59 | {
60 | if (self.willDismissHandler) {
61 | self.willDismissHandler(alertView, buttonIndex);
62 | }
63 | }
64 |
65 | - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex
66 | {
67 | if (self.didDismissHandler) {
68 | self.didDismissHandler(alertView, buttonIndex);
69 | }
70 | }
71 |
72 | - (BOOL)alertViewShouldEnableFirstOtherButton:(UIAlertView *)alertView
73 | {
74 | if (self.shouldEnableHandler) {
75 | self.shouldEnableHandler(alertView);
76 | }
77 | return YES;
78 | }
79 |
80 | #pragma mark - Public Method
81 |
82 | - (void)setClickedHandler:(SCAlertViewClickedHandler)clickedHandler
83 | {
84 | self.delegate = self;
85 |
86 | _clickedHandler = nil;
87 | _clickedHandler = [clickedHandler copy];
88 | }
89 |
90 | - (void)setCancelHandler:(SCAlertViewCancelHandler)cancelHandler
91 | {
92 | self.delegate = self;
93 |
94 | _cancelHandler = nil;
95 | _cancelHandler = [cancelHandler copy];
96 | }
97 |
98 | - (void)setWillPresentHandler:(SCAlertViewWillPresentHandler)willPresentHandler
99 | {
100 | self.delegate = self;
101 |
102 | _willPresentHandler = nil;
103 | _willPresentHandler = [willPresentHandler copy];
104 | }
105 |
106 | - (void)setDidPresentHandler:(SCAlertViewDidPresentHandler)didPresentHandler
107 | {
108 | self.delegate = self;
109 |
110 | _didPresentHandler = nil;
111 | _didPresentHandler = [didPresentHandler copy];
112 | }
113 |
114 | - (void)setWillDismissHandler:(SCAlertViewWillDismissHandler)willDismissHandler
115 | {
116 | self.delegate = self;
117 |
118 | _willDismissHandler = nil;
119 | _willDismissHandler = [willDismissHandler copy];
120 | }
121 |
122 | - (void)setDidDismissHandler:(SCAlertViewDidDismissHandler)didDismissHandler
123 | {
124 | self.delegate = self;
125 |
126 | _didDismissHandler = nil;
127 | _didDismissHandler = [didDismissHandler copy];
128 | }
129 |
130 | - (void)setShouldEnableHandler:(SCAlertViewShouldEnableHandler)shouldEnableHandler
131 | {
132 | self.delegate = self;
133 |
134 | _shouldEnableHandler = nil;
135 | _shouldEnableHandler = [shouldEnableHandler copy];
136 | }
137 |
138 | @end
139 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Views/SCButton/SCButton.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCButton.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/6/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface SCButton : UIButton
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Views/SCButton/SCButton.m:
--------------------------------------------------------------------------------
1 | //
2 | // SCButton.m
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/6/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCButton.h"
10 |
11 | @implementation SCButton
12 |
13 | - (id)initWithFrame:(CGRect)frame
14 | {
15 | self = [super initWithFrame:frame];
16 | if (self) {
17 | // Initialization code
18 | }
19 | return self;
20 | }
21 |
22 | @end
23 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Views/SCDatePicker/SCDatePicker.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCDatePicker.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/6/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCActionView.h"
10 |
11 | typedef void (^SCDatePickerDoneHandler)(NSDate *date);
12 | typedef void (^SCDatePickerCancelHandler)(void);
13 |
14 | @interface SCDatePicker : SCActionView
15 |
16 | /// 时间选择器
17 | @property (nonatomic, strong, readonly) UIDatePicker *datePicker;
18 |
19 | /// 默认显示日期
20 | @property (nonatomic, strong) NSDate *defaultDate;
21 |
22 | - (id)initWithDate:(NSDate *)date;
23 |
24 | - (void)showInView:(UIView *)view
25 | doneHandler:(SCDatePickerDoneHandler)doneHandler
26 | cancelHandler:(SCDatePickerCancelHandler)cancelHandler;
27 |
28 | @end
29 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Views/SCDatePicker/SCDatePicker.m:
--------------------------------------------------------------------------------
1 | //
2 | // SCDatePicker.m
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/6/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCDatePicker.h"
10 | #import "SCToolbar.h"
11 |
12 | #import "SCMacro.h"
13 | #import "SCConstant.h"
14 |
15 | #import "UIView+SCAddition.h"
16 | #import "NSDate+SCAddition.h"
17 |
18 | @interface SCDatePicker ()
19 | <
20 | SCToolbarActionDelegate
21 | >
22 |
23 | /// 工具条
24 | @property (nonatomic, strong) SCToolbar *toolbar;
25 |
26 | /// 时间选择器
27 | @property (nonatomic, strong) UIDatePicker *datePicker;
28 |
29 | /// 完成回调
30 | @property (nonatomic, copy) SCDatePickerDoneHandler doneHandler;
31 |
32 | /// 取消回调
33 | @property (nonatomic, copy) SCDatePickerCancelHandler cancelHandler;
34 |
35 | @end
36 |
37 | @implementation SCDatePicker
38 |
39 | #pragma mark - Init Method
40 |
41 | - (id)initWithFrame:(CGRect)frame
42 | {
43 | frame.size = CGSizeMake(kSC_MAIN_SCREEN_WIDTH,
44 | kSCFW_TOOLBAR_HEIGHT
45 | + kSCFW_DATEPICKER_HEIGHT);
46 | self = [super initWithFrame:frame];
47 | if ( self ) {
48 | self.backgroundColor = [UIColor whiteColor];
49 | self.actionAnimations = SCViewActionAnimationActionSheet;
50 |
51 | _toolbar = [[SCToolbar alloc] init];
52 | _toolbar.size = CGSizeMake(self.width, kSCFW_TOOLBAR_HEIGHT);
53 | _toolbar.barStyle = UIBarStyleBlackTranslucent;
54 | _toolbar.actionStyle = SCToolbarActionStyleDoneAndCancel;
55 | _toolbar.actionDelegate = self;
56 | [self addSubview:_toolbar];
57 |
58 | _datePicker = [[UIDatePicker alloc] init];
59 | _datePicker.size = CGSizeMake(self.width, kSCFW_DATEPICKER_HEIGHT);
60 | _datePicker.top = _toolbar.bottom;
61 | _datePicker.datePickerMode = UIDatePickerModeDate;
62 | _datePicker.minimumDate = [NSDate dateWithTimeIntervalSince1970:0];
63 | _datePicker.maximumDate = [NSDate dateWithTimeIntervalSinceNow:(kSCFW_SECOND_YEAR * 30)];
64 | [self addSubview:_datePicker];
65 | }
66 | return self;
67 | }
68 |
69 | /**
70 | * @brief 初始化
71 | *
72 | * @param date 选中的时间
73 | */
74 | - (id)initWithDate:(NSDate *)date
75 | {
76 | self = [self initWithFrame:CGRectZero];
77 | if (self) {
78 | _datePicker.date = date;
79 | }
80 | return self;
81 | }
82 |
83 | #pragma mark - SCToolbarActionDelegate
84 |
85 | - (void)toolbarDidDone:(SCToolbar *)toolbar
86 | {
87 | if (_doneHandler != nil) {
88 | _doneHandler(_datePicker.date);
89 | }
90 | [self dismiss];
91 | }
92 |
93 | - (void)toolbarDidCancel:(SCToolbar *)toolbar
94 | {
95 | if (_cancelHandler != nil) {
96 | _cancelHandler();
97 | }
98 | [self dismiss];
99 | }
100 |
101 | #pragma mark - Public Method
102 |
103 | /**
104 | * 显示日期选择器
105 | *
106 | * @param doneHandler 完成回调
107 | * @param cancelHandler 取消回调
108 | */
109 | - (void)showInView:(UIView *)view
110 | doneHandler:(SCDatePickerDoneHandler)doneHandler
111 | cancelHandler:(SCDatePickerCancelHandler)cancelHandler
112 | {
113 | self.doneHandler = doneHandler;
114 | self.cancelHandler = cancelHandler;
115 |
116 | [self datePicker].date = (_defaultDate ? _defaultDate : [NSDate date]);
117 | [self showInView:view];
118 | }
119 |
120 | @end
121 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Views/SCLabel/SCLabel.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCLabel.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/6/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface SCLabel : UILabel
12 |
13 | - (void)setText:(NSString *)text adjustWidth:(BOOL)adjustWidth;
14 | - (void)setText:(NSString *)text adjustHeight:(BOOL)adjustHeight;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Views/SCLabel/SCLabel.m:
--------------------------------------------------------------------------------
1 | //
2 | // SCLabel.m
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/6/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCLabel.h"
10 | #import "UIView+SCAddition.h"
11 | #import "NSString+SCAddition.h"
12 |
13 | @implementation SCLabel
14 |
15 | - (id)initWithFrame:(CGRect)frame
16 | {
17 | self = [super initWithFrame:frame];
18 | if (self) {
19 | // Initialization code
20 | }
21 | return self;
22 | }
23 |
24 | #pragma mark - Public Method
25 |
26 | - (void)setText:(NSString *)text adjustWidth:(BOOL)adjustWidth
27 | {
28 | if (adjustWidth) {
29 | CGFloat width = [text widthWithFont:self.font
30 | constrainedToHeight:self.height];
31 | self.width = width;
32 | self.text = text;
33 | } else {
34 | self.text = text;
35 | }
36 | }
37 |
38 | - (void)setText:(NSString *)text adjustHeight:(BOOL)adjustHeight
39 | {
40 | if (adjustHeight) {
41 | CGFloat height = [text heightWithFont:self.font
42 | constrainedToWidth:self.width];
43 | self.height = height;
44 | self.text = text;
45 | } else {
46 | self.text = text;
47 | }
48 | }
49 |
50 | @end
51 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Views/SCPageControl/SCPageControl.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCPageControl.h
3 | // ZhongTouBang
4 | //
5 | // Created by Angzn on 7/16/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface SCPageControl : UIPageControl
12 |
13 | @property (nonatomic, assign, readonly) BOOL firstPage;
14 | @property (nonatomic, assign, readonly) BOOL lastPage;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Views/SCPageControl/SCPageControl.m:
--------------------------------------------------------------------------------
1 | //
2 | // SCPageControl.m
3 | // ZhongTouBang
4 | //
5 | // Created by Angzn on 7/16/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCPageControl.h"
10 |
11 | @interface SCPageControl ()
12 |
13 | @property (nonatomic, assign) BOOL firstPage;
14 | @property (nonatomic, assign) BOOL lastPage;
15 |
16 | @end
17 |
18 | @implementation SCPageControl
19 |
20 | - (BOOL)firstPage
21 | {
22 | return self.currentPage == 0;
23 | }
24 |
25 | - (BOOL)lastPage
26 | {
27 | return self.currentPage == self.numberOfPages - 1;
28 | }
29 |
30 | @end
31 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Views/SCPickerView/SCPickerView.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCPickerView.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/6/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCActionView.h"
10 |
11 | typedef void (^SCPickerViewDoneHandler)(id result);
12 | typedef void (^SCPickerViewCancelHandler)(void);
13 |
14 | @interface SCPickerView : SCActionView
15 |
16 | /// 数据源(字符串/字典/数据对象)
17 | @property (nonatomic, copy) NSArray *dataSources;
18 |
19 | /// 数据值对应的键(在"字典/数据对象"中对应的键)
20 | @property (nonatomic, copy) NSString *valueKey;
21 |
22 | - (id)initWithDataSources:(NSArray *)aDataSources;
23 |
24 | - (void)showInView:(UIView *)view
25 | doneHandler:(SCPickerViewDoneHandler)doneHandler
26 | cancelHandler:(SCPickerViewCancelHandler)cancelHandler;
27 |
28 | @end
29 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Views/SCPickerView/SCPickerView.m:
--------------------------------------------------------------------------------
1 | //
2 | // SCPickerView.m
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/6/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCPickerView.h"
10 | #import "SCToolbar.h"
11 |
12 | #import "SCMacro.h"
13 | #import "SCConstant.h"
14 |
15 | #import "UIView+SCAddition.h"
16 | #import "NSArray+SCAddition.h"
17 |
18 | @interface SCPickerView ()
19 | <
20 | UIPickerViewDelegate,
21 | UIPickerViewDataSource,
22 | SCToolbarActionDelegate
23 | >
24 |
25 | /// 工具条
26 | @property (nonatomic, strong) SCToolbar *toolbar;
27 |
28 | /// 选择器
29 | @property (nonatomic, strong) UIPickerView *pickerView;
30 |
31 | /// 完成回调
32 | @property (nonatomic, copy) SCPickerViewDoneHandler doneHandler;
33 |
34 | /// 取消回调
35 | @property (nonatomic, copy) SCPickerViewCancelHandler cancelHandler;
36 |
37 | @end
38 |
39 |
40 | @implementation SCPickerView
41 |
42 | #pragma mark - Init Method
43 |
44 | - (id)initWithFrame:(CGRect)frame
45 | {
46 | frame.size = CGSizeMake(kSC_MAIN_SCREEN_WIDTH,
47 | kSCFW_TOOLBAR_HEIGHT
48 | + kSCFW_PICKERVIEW_HEIGHT);
49 | self = [super initWithFrame:frame];
50 | if ( self ) {
51 | self.backgroundColor = [UIColor whiteColor];
52 | self.actionAnimations = SCViewActionAnimationActionSheet;
53 |
54 | _toolbar = [[SCToolbar alloc] init];
55 | _toolbar.size = CGSizeMake(self.width, kSCFW_TOOLBAR_HEIGHT);
56 | _toolbar.barStyle = UIBarStyleBlackTranslucent;
57 | _toolbar.actionStyle = SCToolbarActionStyleDoneAndCancel;
58 | _toolbar.actionDelegate = self;
59 | [self addSubview:_toolbar];
60 |
61 | _pickerView = [[UIPickerView alloc] init];
62 | _pickerView.size = CGSizeMake(self.width, kSCFW_DATEPICKER_HEIGHT);
63 | _pickerView.top = _toolbar.bottom;
64 | _pickerView.delegate = self;
65 | _pickerView.dataSource = self;
66 | _pickerView.showsSelectionIndicator = YES;
67 | [self addSubview:_pickerView];
68 | }
69 | return self;
70 | }
71 |
72 | - (id)initWithDataSources:(NSArray *)aDataSources
73 | {
74 | self = [self initWithFrame:CGRectZero];
75 | if (self) {
76 | self.dataSources = aDataSources;
77 | }
78 | return self;
79 | }
80 |
81 | #pragma mark - Setter Method
82 |
83 | - (void)setDataSources:(NSArray *)dataSources
84 | {
85 | _dataSources = [dataSources copy];
86 |
87 | [_pickerView reloadAllComponents];
88 | }
89 |
90 | #pragma mark - SCToolbarActionDelegate
91 |
92 | - (void)toolbarDidDone:(SCToolbar *)toolbar
93 | {
94 | if (_doneHandler != nil) {
95 | NSInteger selectedRow = [_pickerView selectedRowInComponent:0];
96 | id result = nil;
97 | if ([_dataSources isNotEmpty] && [_dataSources count] > selectedRow) {
98 | result = [_dataSources objectAtIndex:selectedRow];
99 | }
100 | _doneHandler(result);
101 | }
102 | [self dismiss];
103 | }
104 |
105 | - (void)toolbarDidCancel:(SCToolbar *)toolbar
106 | {
107 | if (_cancelHandler != nil) {
108 | _cancelHandler();
109 | }
110 | [self dismiss];
111 | }
112 |
113 | #pragma mark - UIPickerViewDelegate & DataSource
114 |
115 | - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
116 | {
117 | return 1;
118 | }
119 |
120 | - (NSInteger)pickerView:(UIPickerView *)pickerView
121 | numberOfRowsInComponent:(NSInteger)component
122 | {
123 | return _dataSources.count;
124 | }
125 |
126 | - (NSString *)pickerView:(UIPickerView *)pickerView
127 | titleForRow:(NSInteger)row
128 | forComponent:(NSInteger)component
129 | {
130 | return [self titleForRow:row];
131 | }
132 |
133 | #pragma mark - Public Method
134 |
135 | /**
136 | * 显示选择器
137 | *
138 | * @param doneHandler 完成回调
139 | * @param cancelHandler 取消回调
140 | */
141 | - (void)showInView:(UIView *)view
142 | doneHandler:(SCPickerViewDoneHandler)doneHandler
143 | cancelHandler:(SCPickerViewCancelHandler)cancelHandler
144 | {
145 | self.doneHandler = doneHandler;
146 | self.cancelHandler = cancelHandler;
147 |
148 | [self.pickerView selectRow:0 inComponent:0 animated:NO];
149 | [self showInView:view];
150 | }
151 |
152 | #pragma mark - Private Method
153 |
154 | - (NSString *)titleForRow:(NSInteger)row
155 | {
156 | NSString *rowTitle = @"";
157 | if (!_dataSources.isNotEmpty || _dataSources.count <= row) {
158 | return rowTitle;
159 | }
160 | id anyObject = [_dataSources objectAtIndex:row];
161 | if ([anyObject isKindOfClass:[NSString class]]) {
162 | rowTitle = [_dataSources objectAtIndex:row];
163 | } else if ([anyObject isKindOfClass:[NSDictionary class]]) {
164 | rowTitle = [(NSDictionary *)anyObject objectForKey:_valueKey];
165 | } else if ([anyObject isKindOfClass:[NSObject class]]) {
166 | rowTitle = [anyObject valueForKey:_valueKey];
167 | }
168 | return rowTitle;
169 | }
170 |
171 | @end
172 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Views/SCScrollView/SCBrowseView.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCBrowseView.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 8/5/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCScrollView.h"
10 | #import "SCBrowseViewPage.h"
11 |
12 | @class SCBrowseView;
13 |
14 | @protocol SCBrowseViewDataSource;
15 | @protocol SCBrowseViewDelegate;
16 |
17 | @interface SCBrowseView : SCScrollView
18 |
19 | @property (nonatomic, weak) id browseDataSource;
20 | @property (nonatomic, weak) id browseDelegate;
21 |
22 | - (id)dequeueReusablePageWithIdentifier:(NSString *)identifier;
23 |
24 | - (void)reloadData;
25 |
26 | - (NSInteger)indexForPageAtPoint:(CGPoint)point;
27 | - (NSInteger)indexForPage:(SCBrowseViewPage *)page;
28 | - (SCBrowseViewPage *)pageForIndex:(NSInteger)index;
29 |
30 | - (void)startPageing;
31 | - (void)stopPageing;
32 | - (BOOL)isPaging;
33 |
34 | @end
35 |
36 |
37 | @protocol SCBrowseViewDataSource
38 |
39 | @required
40 | - (NSInteger)numberOfPagesInBrowseView:(SCBrowseView *)browseView;
41 | - (SCBrowseViewPage *)browseView:(SCBrowseView *)browseView pageAtIndex:(NSInteger)index;
42 |
43 | @end
44 |
45 | @protocol SCBrowseViewDelegate
46 |
47 | @optional
48 | - (void)browseView:(SCBrowseView *)browseView willSelectPageAtIndex:(NSInteger)index;
49 | - (void)browseView:(SCBrowseView *)browseView didSelectPageAtIndex:(NSInteger)index;
50 | - (void)browseViewDidScroll:(SCBrowseView *)browseView;
51 |
52 | @end
53 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Views/SCScrollView/SCBrowseViewPage.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCBrowseViewPage.h
3 | // ZhongTouBang
4 | //
5 | // Created by Angzn on 8/13/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCView.h"
10 |
11 | @class SCBrowseViewPage;
12 |
13 | @interface SCBrowseViewPage : SCView
14 |
15 | @property (nonatomic, readonly, strong) SCView *contentView;
16 |
17 | @property (nonatomic, readonly, copy) NSString *reuseIdentifier;
18 |
19 | - (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier;
20 |
21 | @end
22 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Views/SCScrollView/SCBrowseViewPage.m:
--------------------------------------------------------------------------------
1 | //
2 | // SCBrowseViewPage.m
3 | // ZhongTouBang
4 | //
5 | // Created by Angzn on 8/13/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCBrowseViewPage.h"
10 |
11 | @interface SCBrowseViewPage ()
12 |
13 | @property (nonatomic, strong) SCView *contentView;
14 |
15 | @property (nonatomic, copy) NSString *reuseIdentifier;
16 |
17 | @end
18 |
19 | @implementation SCBrowseViewPage
20 |
21 | #pragma mark - Init Method
22 |
23 | - (void)initialize
24 | {
25 | _contentView = [[SCView alloc] initWithFrame:self.bounds];
26 | _contentView.autoresizingMask = (UIViewAutoresizingFlexibleWidth |
27 | UIViewAutoresizingFlexibleHeight);
28 | [self addSubview:_contentView];
29 | }
30 |
31 | - (id)initWithFrame:(CGRect)frame
32 | {
33 | self = [super initWithFrame:frame];
34 | if (self) {
35 | // Initialization code
36 | [self initialize];
37 | }
38 | return self;
39 | }
40 |
41 | - (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier
42 | {
43 | self = [self initWithFrame:CGRectZero];
44 | if (self) {
45 | // Initialization code
46 | self.reuseIdentifier = reuseIdentifier;
47 | }
48 | return self;
49 | }
50 |
51 | @end
52 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Views/SCScrollView/SCCycleScrollView.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCCycleScrollView.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 15/6/3.
6 | // Copyright (c) 2015年 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCView.h"
10 |
11 | @class SCScrollView;
12 |
13 | @protocol SCCycleScrollViewDataSource;
14 | @protocol SCCycleScrollViewDelegate;
15 |
16 | @interface SCCycleScrollView : SCView
17 | <
18 | UIScrollViewDelegate
19 | >
20 |
21 | @property (nonatomic, weak) id dataSource;
22 | @property (nonatomic, weak) id delegate;
23 |
24 | @property (nonatomic, strong, readonly) SCScrollView *scrollView;
25 | @property (nonatomic, assign, readonly) NSInteger currentPage;
26 |
27 | @property (nonatomic, assign) NSTimeInterval scrollingDuration;
28 |
29 | - (void)reloadData;
30 |
31 | - (void)startPageing;
32 | - (void)stopPageing;
33 | - (BOOL)isPaging;
34 |
35 | - (void)goToPreviousPage;
36 | - (void)goToNextPage;
37 |
38 | @end
39 |
40 | @protocol SCCycleScrollViewDataSource
41 |
42 | @required
43 | - (NSInteger)numberOfPagesInCycleScrollView:(SCCycleScrollView *)cycleView;
44 | - (UIView *)cycleScrollView:(SCCycleScrollView *)cycleView pageAtIndex:(NSInteger)index;
45 |
46 | @end
47 |
48 | @protocol SCCycleScrollViewDelegate
49 |
50 | @optional
51 | - (void)cycleScrollView:(SCCycleScrollView *)cycleView didSelectPageAtIndex:(NSInteger)index;
52 | - (void)cycleScrollViewDidScroll:(SCCycleScrollView *)cycleView;
53 |
54 | @end
55 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Views/SCScrollView/SCScrollView.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCScrollView.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/6/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | /**
12 | * Page方向
13 | */
14 | typedef NS_ENUM(NSUInteger, SCScrollViewPageDirection) {
15 | /**
16 | * 水平
17 | */
18 | SCScrollViewPageDirectionHorizontal,
19 | /**
20 | * 垂直
21 | */
22 | SCScrollViewPageDirectionVertical,
23 | };
24 |
25 | @protocol SCScrollViewTouchDelegate;
26 |
27 | @interface SCScrollView : UIScrollView
28 |
29 | @property (nonatomic, weak) id touchDelegate;
30 |
31 | @property (nonatomic, assign) BOOL endEditingWhenTouch;
32 |
33 | @property (nonatomic, assign) NSInteger numberOfPages;
34 |
35 | @property (nonatomic, assign) SCScrollViewPageDirection pageDirection;
36 |
37 | - (NSInteger)currentPage;
38 |
39 | - (BOOL)isFirstPage;
40 | - (BOOL)isLastPage;
41 |
42 | - (void)scrollToPreviousPage:(BOOL)animated;
43 | - (void)scrollToNextPage:(BOOL)animated;
44 | - (void)scrollToPreviousPage;
45 | - (void)scrollToNextPage;
46 | - (void)scrollToFirstPage;
47 | - (void)scrollToLastPage;
48 |
49 | @end
50 |
51 |
52 | @protocol SCScrollViewTouchDelegate
53 |
54 | @optional
55 | - (void)scrollView:(SCScrollView *)scrollView touchEnded:(NSSet *)touches withEvent:(UIEvent *)event;
56 | - (BOOL)scrollView:(SCScrollView *)scrollView touchShouldBegin:(NSSet *)touches withEvent:(UIEvent *)event inContentView:(id)view;
57 | - (BOOL)scrollView:(SCScrollView *)scrollView touchesShouldCancelInContentView:(UIView *)view;
58 |
59 | @end
60 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Views/SCTableView/SCCircleView.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCCircleView.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/10/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCView.h"
10 |
11 | @interface SCCircleView : SCView
12 |
13 | @property (nonatomic, strong) UIColor *trackColor;
14 | @property (nonatomic, strong) UIColor *progressColor;
15 | @property (nonatomic, assign) CGFloat progressWidth;
16 | @property (nonatomic, assign) CGFloat progress; //0~1之间的数
17 |
18 | - (void)startRotating;
19 | - (void)stopRotating;
20 |
21 | @end
22 |
23 | /*
24 | @interface SCCircleView : SCView
25 | {
26 | CAShapeLayer *_trackLayer;
27 |
28 | CAShapeLayer *_progressLayer;
29 | }
30 |
31 | @property (nonatomic, strong) UIColor *trackColor;
32 | @property (nonatomic, strong) UIColor *progressColor;
33 | @property (nonatomic, assign) CGFloat progressWidth;
34 | @property (nonatomic, assign) CGFloat progress; //0~1之间的数
35 |
36 | - (void)startRotating;
37 | - (void)stopRotating;
38 |
39 | @end
40 | */
41 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Views/SCTableView/SCExpandTableView.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCExpandTableView.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 4/29/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCTableView.h"
10 |
11 | @protocol SCExpandTableViewDelegate;
12 |
13 | @interface SCExpandTableView : SCTableView
14 |
15 | @property (nonatomic, weak) id expandDelegate;
16 |
17 | @property (nonatomic, assign) BOOL shouldExpandOnlyOneCell;
18 |
19 | - (BOOL)isExpandedForCellAtIndexPath:(NSIndexPath *)indexPath;
20 |
21 | @end
22 |
23 |
24 | #pragma mark - SCExpandTableViewDelegate
25 |
26 | @protocol SCExpandTableViewDelegate
27 |
28 | @required
29 | - (NSInteger)tableView:(SCExpandTableView *)tableView numberOfSubRowsAtIndexPath:(NSIndexPath *)indexPath;
30 | - (UITableViewCell *)tableView:(SCExpandTableView *)tableView cellForSubRowAtIndexPath:(NSIndexPath *)indexPath;
31 |
32 | @optional
33 | - (CGFloat)tableView:(SCExpandTableView *)tableView heightForSubRowAtIndexPath:(NSIndexPath *)indexPath;
34 |
35 | @end
36 |
37 |
38 | #pragma mark - NSIndexPath (SCExpandTableView)
39 |
40 | @interface NSIndexPath (SCExpandTableView)
41 |
42 | @property (nonatomic, assign) NSInteger subRow;
43 |
44 | + (NSIndexPath *)indexPathForSubRow:(NSInteger)subrow inRow:(NSInteger)row inSection:(NSInteger)section;
45 |
46 | @end
47 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Views/SCTableView/SCExpandTableView.m:
--------------------------------------------------------------------------------
1 | //
2 | // SCExpandTableView.m
3 | // SCFramework
4 | //
5 | // Created by Angzn on 4/29/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCExpandTableView.h"
10 | #import
11 |
12 | #import "SCExpandTableViewCell.h"
13 |
14 | #pragma mark - NSArray (SCExpandTableView)
15 |
16 | @interface NSMutableArray (SCExpandTableView)
17 |
18 | - (void)initiateObjectsForCapacity:(NSInteger)numItems;
19 |
20 | @end
21 |
22 | @implementation NSMutableArray (SKSTableView)
23 |
24 | - (void)initiateObjectsForCapacity:(NSInteger)numItems
25 | {
26 | for (NSInteger index = [self count]; index < numItems; index++) {
27 | NSMutableArray *array = [NSMutableArray array];
28 | [self addObject:array];
29 | }
30 | }
31 |
32 | @end
33 |
34 |
35 | #pragma mark - SCExpandTableView
36 |
37 | @interface SCExpandTableView ()
38 | <
39 | UITableViewDataSource,
40 | UITableViewDelegate
41 | >
42 |
43 | @property (nonatomic, strong) NSMutableArray *expandedIndexPaths;
44 |
45 | @property (nonatomic, strong) NSMutableDictionary *expandableCells;
46 |
47 | @end
48 |
49 |
50 | @implementation SCExpandTableView
51 |
52 | - (BOOL)isExpandedForCellAtIndexPath:(NSIndexPath *)indexPath
53 | {
54 | BOOL expanded = NO;
55 | return expanded;
56 | }
57 |
58 | #pragma mark - UITableViewDataSource & UITableViewDelegate
59 |
60 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
61 | {
62 | return 0;
63 | }
64 |
65 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
66 | {
67 | return 0;
68 | }
69 |
70 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
71 | {
72 | static NSString *cellIdentifier = @"ExpandCell";
73 | SCExpandTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
74 | if (!cell) {
75 | cell = [[SCExpandTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
76 | reuseIdentifier:cellIdentifier];
77 | }
78 | return cell;
79 | }
80 |
81 | @end
82 |
83 |
84 | #pragma mark - NSIndexPath (SCExpandTableView)
85 |
86 | static void *SCFWNSIndexPathSubRowObjectKey;
87 |
88 | @implementation NSIndexPath (SCExpandTableView)
89 |
90 | @dynamic subRow;
91 |
92 | - (NSInteger)subRow
93 | {
94 | id subRowObj = objc_getAssociatedObject(self, SCFWNSIndexPathSubRowObjectKey);
95 | return [subRowObj integerValue];
96 | }
97 |
98 | - (void)setSubRow:(NSInteger)subRow
99 | {
100 | id subRowObj = [NSNumber numberWithInteger:subRow];
101 | objc_setAssociatedObject(self, SCFWNSIndexPathSubRowObjectKey, subRowObj, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
102 | }
103 |
104 | + (NSIndexPath *)indexPathForSubRow:(NSInteger)subrow inRow:(NSInteger)row inSection:(NSInteger)section
105 | {
106 | NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row inSection:section];
107 | indexPath.subRow = subrow;
108 | return indexPath;
109 | }
110 |
111 | @end
112 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Views/SCTableView/SCPullLoadView.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCPullLoadView.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/6/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCView.h"
10 |
11 | extern const CGFloat kSCPullLoadViewHeight;
12 |
13 | extern const CGFloat kSCPullUpDistance;
14 |
15 | typedef NS_ENUM(NSInteger, SCPullUpState) {
16 | SCPullUpStateNormal = 1,// 正常
17 | SCPullUpStatePulling,// 上拉中
18 | SCPullUpStateLoading,// 加载中
19 | };
20 |
21 | @interface SCPullLoadView : SCView
22 |
23 | @property (nonatomic, strong, readonly) UILabel *statusLabel;
24 |
25 | @property (nonatomic, strong, readonly) UIActivityIndicatorView *activityView;
26 |
27 | @property (nonatomic, assign) SCPullUpState state;
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Views/SCTableView/SCPullLoadView.m:
--------------------------------------------------------------------------------
1 | //
2 | // SCPullLoadView.m
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/6/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCPullLoadView.h"
10 | #import "UIDevice+SCAddition.h"
11 |
12 | const CGFloat kSCPullLoadViewHeight = 40.f;
13 |
14 | const CGFloat kSCPullUpDistance = 0.f;
15 |
16 | @implementation SCPullLoadView
17 |
18 | - (id)initWithFrame:(CGRect)frame
19 | {
20 | self = [super initWithFrame:frame];
21 | if (self) {
22 | // Initialization code
23 | self.backgroundColor = [UIColor clearColor];
24 | self.autoresizingMask = UIViewAutoresizingFlexibleWidth;
25 |
26 | CGFloat thisWidth = CGRectGetWidth(frame);
27 |
28 | _statusLabel = [[UILabel alloc] initWithFrame:CGRectMake(0.0f,
29 | 10.0f,
30 | thisWidth,
31 | 20.0f)];
32 | _statusLabel.backgroundColor = [UIColor clearColor];
33 | _statusLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth;
34 | _statusLabel.font = [UIFont boldSystemFontOfSize:[UIDevice iPad] ? 15.0f : 13.0f];
35 | _statusLabel.textColor = [UIColor darkGrayColor];
36 | _statusLabel.shadowColor = [UIColor colorWithWhite:0.9f alpha:1.0f];
37 | _statusLabel.shadowOffset = CGSizeMake(0.0f, 1.0f);
38 | _statusLabel.textAlignment = NSTextAlignmentCenter;
39 | [self addSubview:_statusLabel];
40 |
41 | _activityView = [[UIActivityIndicatorView alloc]
42 | initWithActivityIndicatorStyle:
43 | UIActivityIndicatorViewStyleGray];
44 | _activityView.backgroundColor = [UIColor clearColor];
45 | _activityView.frame = CGRectMake(40.0f,
46 | 10.0f,
47 | 20.0f,
48 | 20.0f);
49 | [self addSubview:_activityView];
50 |
51 | [self setState:SCPullUpStateNormal];
52 | }
53 | return self;
54 | }
55 |
56 | #pragma mark - Public Methods
57 |
58 | - (void)setState:(SCPullUpState)state
59 | {
60 | if (_state != state) {
61 |
62 | NSString *statusText = nil;
63 | switch (state) {
64 | case SCPullUpStatePulling:
65 | statusText = NSLocalizedStringFromTable(@"SCFW_LS_Release to load", @"SCFWLocalizable", nil);
66 | break;
67 | case SCPullUpStateNormal:
68 | statusText = NSLocalizedStringFromTable(@"SCFW_LS_Pull up to load", @"SCFWLocalizable", nil);
69 | [_activityView stopAnimating];
70 | break;
71 | case SCPullUpStateLoading:
72 | statusText = NSLocalizedStringFromTable(@"SCFW_LS_Loading", @"SCFWLocalizable", nil);
73 | [_activityView startAnimating];
74 | break;
75 | default:
76 | break;
77 | }
78 | _statusLabel.text = statusText;
79 |
80 | _state = state;
81 | }
82 | }
83 |
84 | @end
85 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Views/SCTableView/SCPullRefreshView.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCPullRefreshView.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/6/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCView.h"
10 | #import "SCCircleView.h"
11 |
12 | extern const CGFloat kSCPullRefreshViewHeight;
13 |
14 | extern const CGFloat kSCPullDownDistance;
15 |
16 | typedef NS_ENUM(NSInteger, SCPullDownState) {
17 | SCPullDownStateNormal = 1,// 正常
18 | SCPullDownStatePulling,// 下拉中
19 | SCPullDownStateRefreshing,// 刷新中
20 | };
21 |
22 | @interface SCPullRefreshView : SCView
23 |
24 | @property (nonatomic, strong, readonly) UILabel *statusLabel;
25 |
26 | @property (nonatomic, strong, readonly) UILabel *dateLabel;
27 |
28 | @property (nonatomic, strong, readonly) SCCircleView *circleView;
29 | //@property (nonatomic, strong, readonly) UIActivityIndicatorView *activityView;
30 |
31 | @property (nonatomic, assign) SCPullDownState state;
32 | @property (nonatomic, assign) CGFloat pullScale;
33 |
34 | - (void)refreshLastUpdatedDate:(NSDate *)date;
35 |
36 | @end
37 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Views/SCTableView/SCTableView.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCTableView.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/6/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @class SCPullRefreshView;
12 | @class SCPullLoadView;
13 |
14 | @protocol SCTableViewPullDelegate;
15 |
16 | @interface SCTableView : UITableView
17 |
18 | @property (nonatomic, weak) id pullDelegate;
19 |
20 | @property (nonatomic, strong, readonly) SCPullRefreshView *pullRefreshView;
21 | @property (nonatomic, strong, readonly) SCPullLoadView *pullLoadView;
22 |
23 | @property (nonatomic, assign, getter = isRefreshEnabled) BOOL refreshEnabled;
24 | @property (nonatomic, assign, getter = isLoadEnabled) BOOL loadEnabled;
25 |
26 | @property (nonatomic, assign, readonly, getter = isRefreshing) BOOL refreshing;
27 | @property (nonatomic, assign, readonly, getter = isLoading) BOOL loading;
28 |
29 | - (void)tableViewDidScroll:(UIScrollView *)scrollView;
30 | - (void)tableViewDidEndDragging:(UIScrollView *)scrollView;
31 |
32 | - (void)tableViewDataSourceDidFinishedRefresh;
33 | - (void)tableViewDataSourceDidFinishedLoadMore;
34 |
35 | - (void)tableViewDataSourceWillStartRefresh;
36 |
37 | @property (nonatomic, assign) BOOL endEditingWhenTouch;
38 |
39 | @end
40 |
41 |
42 | @protocol SCTableViewPullDelegate
43 |
44 | @optional
45 | - (void)tableViewDidStartRefresh:(SCTableView *)tableView;
46 | - (NSDate *)tableViewRefreshFinishedDate;
47 |
48 | - (void)tableViewDidStartLoadMore:(SCTableView *)tableView;
49 |
50 | @end
51 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Views/SCTableViewCell/SCExpandTableViewCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCExpandTableViewCell.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 4/29/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCTableViewCell.h"
10 |
11 | @interface SCExpandTableViewCell : SCTableViewCell
12 |
13 | /**
14 | * The boolean value showing the receiver is expandable or not.
15 | * The default value of this property is NO.
16 | */
17 | @property (nonatomic, assign, getter = isExpandable) BOOL expandable;
18 |
19 | /**
20 | * The boolean value showing the receiver is expanded or not.
21 | * The default value of this property is NO.
22 | */
23 | @property (nonatomic, assign, getter = isExpanded) BOOL expanded;
24 |
25 | @end
26 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Views/SCTableViewCell/SCExpandTableViewCell.m:
--------------------------------------------------------------------------------
1 | //
2 | // SCExpandTableViewCell.m
3 | // SCFramework
4 | //
5 | // Created by Angzn on 4/29/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCExpandTableViewCell.h"
10 |
11 | @implementation SCExpandTableViewCell
12 |
13 | - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
14 | {
15 | self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
16 | if (self) {
17 | // Initialization code
18 | }
19 | return self;
20 | }
21 |
22 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated
23 | {
24 | [super setSelected:selected animated:animated];
25 |
26 | // Configure the view for the selected state
27 | }
28 |
29 | #pragma mark - Public Method
30 |
31 | - (void)setExpandable:(BOOL)expandable
32 | {
33 | if (_expanded != expandable) {
34 | _expanded = expandable;
35 | if (expandable) {
36 | self.accessoryView = [self expandableView];
37 | } else {
38 | self.accessoryView = nil;
39 | }
40 | }
41 | }
42 |
43 | #pragma mark - Private Method
44 |
45 | - (UIView *)expandableView
46 | {
47 | return nil;
48 | }
49 |
50 | @end
51 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Views/SCTableViewCell/SCTableViewCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCTableViewCell.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/11/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface SCTableViewCell : UITableViewCell
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Views/SCTableViewCell/SCTableViewCell.m:
--------------------------------------------------------------------------------
1 | //
2 | // SCTableViewCell.m
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/11/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCTableViewCell.h"
10 |
11 | @implementation SCTableViewCell
12 |
13 | - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
14 | {
15 | self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
16 | if (self) {
17 | // Initialization code
18 | }
19 | return self;
20 | }
21 |
22 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated
23 | {
24 | [super setSelected:selected animated:animated];
25 |
26 | // Configure the view for the selected state
27 | }
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Views/SCTextField/SCTextField.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCTextField.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/6/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface SCTextField : UITextField
12 |
13 | @property (nonatomic, strong) UIImage *leftImage;
14 | @property (nonatomic, copy ) NSString *leftText;
15 |
16 | - (void)setLeftText:(NSString *)leftText forFont:(UIFont *)font;
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Views/SCTextField/SCTextField.m:
--------------------------------------------------------------------------------
1 | //
2 | // SCTextField.m
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/6/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCTextField.h"
10 |
11 | @implementation SCTextField
12 |
13 | - (id)initWithFrame:(CGRect)frame
14 | {
15 | self = [super initWithFrame:frame];
16 | if (self) {
17 | // Initialization code
18 | }
19 | return self;
20 | }
21 |
22 | #pragma mark - Public Method
23 |
24 | - (void)setLeftImage:(UIImage *)leftImage
25 | {
26 | _leftImage = leftImage;
27 |
28 | UIImageView *leftView = [[UIImageView alloc] initWithImage:leftImage];
29 | leftView.contentMode = UIViewContentModeCenter;
30 | self.leftView = leftView;
31 | }
32 |
33 | - (void)setLeftText:(NSString *)leftText
34 | {
35 | _leftText = [leftText copy];
36 |
37 | UILabel *leftView = [[UILabel alloc] init];
38 | leftView.text = leftText;
39 | [leftView sizeToFit];
40 | self.leftView = leftView;
41 | }
42 |
43 | - (void)setLeftText:(NSString *)leftText forFont:(UIFont *)font
44 | {
45 | _leftText = [leftText copy];
46 |
47 | UILabel *leftView = [[UILabel alloc] init];
48 | leftView.text = leftText;
49 | leftView.font = font;
50 | [leftView sizeToFit];
51 | self.leftView = leftView;
52 | }
53 |
54 | @end
55 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Views/SCTextView/SCTextView.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCTextView.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/6/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface SCTextView : UITextView
12 |
13 | @property (nonatomic, assign) BOOL endEditingWhenSlide;
14 |
15 | @property (nonatomic, copy ) NSString *placeholder;
16 | @property (nonatomic, strong) UIColor *placeholderColor;
17 |
18 | @property (nonatomic, readonly) NSUInteger numberOfLines;
19 |
20 | @end
21 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Views/SCTextView/SCTextView.m:
--------------------------------------------------------------------------------
1 | //
2 | // SCTextView.m
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/6/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCTextView.h"
10 | #import "NSString+SCAddition.h"
11 |
12 | @interface SCTextView ()
13 |
14 | @property (nonatomic, strong) UILabel *placeholderLabel;
15 |
16 | @end
17 |
18 | @implementation SCTextView
19 |
20 | - (void)dealloc
21 | {
22 | [self sc_unregisterNotification];
23 | }
24 |
25 | #pragma mark - Init Method
26 |
27 | - (void)initialize
28 | {
29 | [self sc_registerNotification];
30 | }
31 |
32 | - (id)initWithFrame:(CGRect)frame
33 | {
34 | self = [super initWithFrame:frame];
35 | if (self) {
36 | // Initialization code
37 | [self initialize];
38 | }
39 | return self;
40 | }
41 |
42 | #pragma mark - UIView Override
43 |
44 | - (void)layoutSubviews
45 | {
46 | [super layoutSubviews];
47 |
48 | self.placeholderLabel.hidden = [self __shouldHidePlaceholder];
49 |
50 | if (!self.placeholderLabel.hidden) {
51 | [UIView performWithoutAnimation:^{
52 | self.placeholderLabel.frame = [self __placeholderRectThatFits:self.bounds];
53 | [self sendSubviewToBack:self.placeholderLabel];
54 | }];
55 | }
56 | }
57 |
58 | #pragma mark - UITextView Override
59 |
60 | - (void)setFont:(UIFont *)font
61 | {
62 | [super setFont:font];
63 |
64 | self.placeholderLabel.font = self.font;
65 | }
66 |
67 | - (void)setText:(NSString *)text
68 | {
69 | [super setText:text];
70 | }
71 |
72 | #pragma mark - UIResponder Touch Methods
73 |
74 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
75 | {
76 | [super touchesBegan:touches withEvent:event];
77 | }
78 |
79 | - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
80 | {
81 | [super touchesMoved:touches withEvent:event];
82 | if ( _endEditingWhenSlide ) {
83 | [self resignFirstResponder];
84 | }
85 | }
86 |
87 | - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
88 | {
89 | [super touchesEnded:touches withEvent:event];
90 | }
91 |
92 | - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
93 | {
94 | [super touchesCancelled:touches withEvent:event];
95 | }
96 |
97 | #pragma mark - Getter Method
98 |
99 | - (UILabel *)placeholderLabel
100 | {
101 | if (!_placeholderLabel) {
102 | _placeholderLabel = [[UILabel alloc] init];
103 | _placeholderLabel.backgroundColor = [UIColor clearColor];
104 | _placeholderLabel.textColor = [UIColor lightGrayColor];
105 | _placeholderLabel.numberOfLines = 0;
106 | _placeholderLabel.hidden = YES;
107 | _placeholderLabel.font = self.font;
108 | [self addSubview:_placeholderLabel];
109 | }
110 | return _placeholderLabel;
111 | }
112 |
113 | - (NSString *)placeholder
114 | {
115 | return self.placeholderLabel.text;
116 | }
117 |
118 | - (UIColor *)placeholderColor
119 | {
120 | return self.placeholderLabel.textColor;
121 | }
122 |
123 | - (NSUInteger)numberOfLines
124 | {
125 | return fabs(self.contentSize.height / self.font.lineHeight);
126 | }
127 |
128 | #pragma mark - Public Method
129 |
130 | - (void)setPlaceholder:(NSString *)placeholder
131 | {
132 | self.placeholderLabel.text = placeholder;
133 |
134 | [self setNeedsLayout];
135 | }
136 |
137 | - (void)setPlaceholderColor:(UIColor *)color
138 | {
139 | self.placeholderLabel.textColor = color;
140 | }
141 |
142 | #pragma mark - Private Method
143 |
144 | - (BOOL)__shouldHidePlaceholder
145 | {
146 | if (![self.placeholder isNotEmpty] || [self.text isNotEmpty]) {
147 | return YES;
148 | }
149 | return NO;
150 | }
151 |
152 | - (CGRect)__placeholderRectThatFits:(CGRect)bounds
153 | {
154 | CGRect rect = CGRectZero;
155 |
156 | rect.size = [self.placeholderLabel sizeThatFits:bounds.size];
157 | rect.origin = UIEdgeInsetsInsetRect(bounds, self.textContainerInset).origin;
158 |
159 | CGFloat padding = self.textContainer.lineFragmentPadding;
160 | rect.origin.x += padding;
161 |
162 | return rect;
163 | }
164 |
165 | #pragma mark - Notification Method
166 |
167 | - (void)sc_registerNotification
168 | {
169 | [[NSNotificationCenter defaultCenter] addObserver:self
170 | selector:@selector(sc_textViewDidChange:)
171 | name:UITextViewTextDidChangeNotification
172 | object:nil];
173 | }
174 |
175 | - (void)sc_unregisterNotification
176 | {
177 | [[NSNotificationCenter defaultCenter] removeObserver:self
178 | name:UITextViewTextDidChangeNotification
179 | object:nil];
180 | }
181 |
182 | - (void)sc_textViewDidChange:(NSNotification *)notification
183 | {
184 | if (![notification.object isEqual:self]) {
185 | return;
186 | }
187 |
188 | if (self.placeholderLabel.hidden != [self __shouldHidePlaceholder]) {
189 | [self setNeedsLayout];
190 | }
191 | }
192 |
193 | @end
194 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Views/SCToolbar/SCToolbar.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCToolbar.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 9/23/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | typedef NS_ENUM(NSUInteger, SCToolbarActionStyle) {
12 | SCToolbarActionStyleNone,
13 | SCToolbarActionStyleDoneAndCancel,
14 | };
15 |
16 | @protocol SCToolbarActionDelegate;
17 |
18 | @interface SCToolbar : UIToolbar
19 |
20 | @property (nonatomic, weak) id actionDelegate;
21 |
22 | @property (nonatomic, assign) SCToolbarActionStyle actionStyle;
23 |
24 | - (instancetype)initWithFrame:(CGRect)frame actionStyle:(SCToolbarActionStyle)actionStyle;
25 |
26 | @end
27 |
28 | @protocol SCToolbarActionDelegate
29 |
30 | - (void)toolbarDidDone:(SCToolbar *)toolbar;
31 | - (void)toolbarDidCancel:(SCToolbar *)toolbar;
32 |
33 | @end
34 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Views/SCToolbar/SCToolbar.m:
--------------------------------------------------------------------------------
1 | //
2 | // SCToolbar.m
3 | // SCFramework
4 | //
5 | // Created by Angzn on 9/23/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCToolbar.h"
10 |
11 | #import "UIBarButtonItem+SCAddition.h"
12 |
13 | #import "SCAdaptedSystem.h"
14 |
15 | @implementation SCToolbar
16 |
17 | - (instancetype)initWithFrame:(CGRect)frame actionStyle:(SCToolbarActionStyle)actionStyle
18 | {
19 | self = [super initWithFrame:frame];
20 | if (self) {
21 | // Initialization code
22 | self.actionStyle = actionStyle;
23 | }
24 | return self;
25 | }
26 |
27 | #pragma mark - Action Method
28 |
29 | - (void)doneAction:(__unused id)sender
30 | {
31 | if (_actionDelegate && [_actionDelegate respondsToSelector:@selector(toolbarDidDone:)]) {
32 | [_actionDelegate toolbarDidDone:self];
33 | }
34 | }
35 |
36 | - (void)cancelAction:(__unused id)sender
37 | {
38 | if (_actionDelegate && [_actionDelegate respondsToSelector:@selector(toolbarDidCancel:)]) {
39 | [_actionDelegate toolbarDidCancel:self];
40 | }
41 | }
42 |
43 | #pragma mark - Public Method
44 |
45 | - (void)setActionStyle:(SCToolbarActionStyle)actionStyle
46 | {
47 | if (_actionStyle != actionStyle) {
48 | _actionStyle = actionStyle;
49 | [self __setActionStyle];
50 | }
51 | }
52 |
53 | #pragma mark - Private Method
54 |
55 | - (void)__setActionStyle
56 | {
57 | if (_actionStyle == SCToolbarActionStyleDoneAndCancel) {
58 | [self __setActionStyleDoneAndCancel];
59 | }
60 | }
61 |
62 | - (void)__setActionStyleDoneAndCancel
63 | {
64 | UIBarButtonItem *cancelBarItem = [[UIBarButtonItem alloc] initWithTarget:self
65 | action:@selector(cancelAction:)];
66 | cancelBarItem.title = NSLocalizedStringFromTable(@"SCFW_LS_Cancel", @"SCFWLocalizable", nil);
67 | cancelBarItem.style = UIBarButtonItemStyleDone;
68 |
69 | UIBarButtonItem *flexibleSpaceItem = [UIBarButtonItem flexibleSpaceSystemItem];
70 |
71 | UIBarButtonItem *doneBarItem = [[UIBarButtonItem alloc] initWithTarget:self
72 | action:@selector(doneAction:)];
73 | doneBarItem.title = NSLocalizedStringFromTable(@"SCFW_LS_Done", @"SCFWLocalizable", nil);
74 | doneBarItem.style = UIBarButtonItemStyleDone;
75 |
76 | self.items = @[cancelBarItem, flexibleSpaceItem, doneBarItem];
77 | }
78 |
79 | @end
80 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Views/SCView/SCActionView.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCActionView.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 9/19/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCView.h"
10 |
11 | typedef BOOL(^SCActionViewWillTapCancelHandler)(void);
12 | typedef void(^SCActionViewDidTapCancelHandler)(void);
13 |
14 | typedef NS_ENUM(NSUInteger, SCViewActionAnimations) {
15 | SCViewActionAnimationActionSheet,
16 | SCViewActionAnimationAlert,
17 | };
18 |
19 | @interface SCActionView : SCView
20 |
21 | @property (nonatomic, assign) NSTimeInterval duration;
22 | @property (nonatomic, assign) NSTimeInterval delay;
23 | @property (nonatomic, assign) UIViewAnimationOptions animationOptions;
24 | @property (nonatomic, assign) SCViewActionAnimations actionAnimations;
25 |
26 | @property (nonatomic, readonly, getter=isVisible) BOOL visible;
27 |
28 | @property (nonatomic, assign) BOOL tapCancelDisabled;
29 |
30 | @property (nonatomic, copy) SCActionViewWillTapCancelHandler willTapCancelHandler;
31 | @property (nonatomic, copy) SCActionViewDidTapCancelHandler didTapCancelHandler;
32 |
33 | - (void)showInView:(UIView *)view;
34 | - (void)dismiss;
35 |
36 | @end
37 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Views/SCView/SCView.h:
--------------------------------------------------------------------------------
1 | //
2 | // SCView.h
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/6/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface SCView : UIView
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/Views/SCView/SCView.m:
--------------------------------------------------------------------------------
1 | //
2 | // SCView.m
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/6/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import "SCView.h"
10 |
11 | @implementation SCView
12 |
13 | - (id)initWithFrame:(CGRect)frame
14 | {
15 | self = [super initWithFrame:frame];
16 | if (self) {
17 | // Initialization code
18 | }
19 | return self;
20 | }
21 |
22 | @end
23 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/en.lproj/SCFWLocalizable.strings:
--------------------------------------------------------------------------------
1 | /*
2 | SCFWLocalizable.strings
3 | SCFramework
4 |
5 | Created by Angzn on 3/5/14.
6 | Copyright (c) 2014 Richer VC. All rights reserved.
7 | */
8 |
9 | "SCFW_LS_OK" = "OK";
10 | "SCFW_LS_Done" = "Done";
11 | "SCFW_LS_Cancel" = "Cancel";
12 |
13 | "SCFW_LS_Release to refresh" = "Release to refresh";
14 | "SCFW_LS_Pull down to refresh" = "Pull down to refresh";
15 | "SCFW_LS_Refreshing" = "Refreshing...";
16 |
17 | "SCFW_LS_Release to load" = "Release to load";
18 | "SCFW_LS_Pull up to load" = "Pull up to load";
19 | "SCFW_LS_Loading" = "Loading...";
20 |
21 | "SCFW_LS_Last updated time" = "Last updated";
22 | "SCFW_LS_Last updated today" = "Today";
23 | "SCFW_LS_Last updated yesterday" = "Yesterday";
24 | "SCFW_LS_Last updated before yesterday" = "Before yesterday";
25 |
26 | "SCFW_LS_Take a picture" = "Take a picture";
27 | "SCFW_LS_Choose from album" = "Choose from album";
28 |
29 | "SCFW_LS_Update Available" = "Update Available";
30 | "SCFW_LS_A new version of %@ is available. Please update to version %@ now." = "A new version of \"%@\" is available. Please update to version %@ now.";
31 | "SCFW_LS_Update" = "Update";
32 | "SCFW_LS_Next time" = "Next time";
33 | "SCFW_LS_Skip this version" = "Skip this version";
34 |
35 | "SCFW_LS_Location Services Disenable" = "Location services disenable, please open location services in \"Settings\"-\"Privacy\"-\"Location\"";
36 | "SCFW_LS_Locate Fail" = "Locate fail";
37 |
38 | "SCFW_LS_Photos Services Disenable" = "Photos disenable, please open in \"Settings\"-\"Privacy\"-\"Photos\"";
39 | "SCFW_LS_Camera Services Disenable" = "Camera disenable, please open in \"Settings\"-\"Privacy\"-\"Camera\"";
40 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/SCFramework/zh-Hans.lproj/SCFWLocalizable.strings:
--------------------------------------------------------------------------------
1 | /*
2 | SCFWLocalizable.strings
3 | SCFramework
4 |
5 | Created by Angzn on 3/5/14.
6 | Copyright (c) 2014 Richer VC. All rights reserved.
7 | */
8 |
9 | "SCFW_LS_OK" = "确定";
10 | "SCFW_LS_Done" = "完成";
11 | "SCFW_LS_Cancel" = "取消";
12 |
13 | "SCFW_LS_Release to refresh" = "释放刷新";
14 | "SCFW_LS_Pull down to refresh" = "下拉刷新";
15 | "SCFW_LS_Refreshing" = "正在刷新中...";
16 |
17 | "SCFW_LS_Release to load" = "释放加载";
18 | "SCFW_LS_Pull up to load" = "上拉加载";
19 | "SCFW_LS_Loading" = "正在加载中...";
20 |
21 | "SCFW_LS_Last updated time" = "最后更新";
22 | "SCFW_LS_Last updated today" = "今天";
23 | "SCFW_LS_Last updated yesterday" = "昨天";
24 | "SCFW_LS_Last updated before yesterday" = "前天";
25 |
26 | "SCFW_LS_Take a picture" = "拍照";
27 | "SCFW_LS_Choose from album" = "从相册中选择";
28 |
29 | "SCFW_LS_Update Available" = "更新可用";
30 | "SCFW_LS_A new version of %@ is available. Please update to version %@ now." = "“%@”的新版本可用. 请更新到%@版本.";
31 | "SCFW_LS_Update" = "更新";
32 | "SCFW_LS_Next time" = "下一次";
33 | "SCFW_LS_Skip this version" = "跳过此版本";
34 |
35 | "SCFW_LS_Location Services Disenable" = "定位服务不可用, 请在\"设置\"-\"隐私\"-\"定位服务\"中打开定位服务";
36 | "SCFW_LS_Locate Fail" = "定位失败";
37 |
38 | "SCFW_LS_Photos Services Disenable" = "照片库禁止访问, 请在\"设置\"-\"隐私\"-\"照片\"中开启";
39 | "SCFW_LS_Camera Services Disenable" = "照相机禁止访问, 请在\"设置\"-\"隐私\"-\"相机\"中开启";
40 |
--------------------------------------------------------------------------------
/SCFramework/SCFramework/TestPic.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kangchuh/SCFramework/613834718e94eae2c37a26e13ec5bb1defef059e/SCFramework/SCFramework/TestPic.jpg
--------------------------------------------------------------------------------
/SCFramework/SCFramework/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // SCFramework
4 | //
5 | // Created by Angzn on 3/4/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #import "AppDelegate.h"
12 |
13 | int main(int argc, char * argv[])
14 | {
15 | @autoreleasepool {
16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/SCFramework/SCFrameworkTests/SCFrameworkTests-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundlePackageType
14 | BNDL
15 | CFBundleShortVersionString
16 | 1.0
17 | CFBundleSignature
18 | ????
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/SCFramework/SCFrameworkTests/SCFrameworkTests.m:
--------------------------------------------------------------------------------
1 | //
2 | // SCFrameworkTests.m
3 | // SCFrameworkTests
4 | //
5 | // Created by Angzn on 3/4/14.
6 | // Copyright (c) 2014 Richer VC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface SCFrameworkTests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation SCFrameworkTests
16 |
17 | - (void)setUp
18 | {
19 | [super setUp];
20 | // Put setup code here. This method is called before the invocation of each test method in the class.
21 | }
22 |
23 | - (void)tearDown
24 | {
25 | // Put teardown code here. This method is called after the invocation of each test method in the class.
26 | [super tearDown];
27 | }
28 |
29 | - (void)testExample
30 | {
31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__);
32 | }
33 |
34 | @end
35 |
--------------------------------------------------------------------------------
/SCFramework/SCFrameworkTests/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys */
2 |
3 |
--------------------------------------------------------------------------------