Commit 8ea548467d0d5f89e5ae504bb2c0efd9ae126343
1 parent
89c5d142
提交更改基本配置,导入必要图片,导出路径进行更改
Showing
37 changed files
with
209 additions
and
464 deletions
CNLiveImagePickerController/AppCommonDefine.h deleted
100644 → 0
| 1 | -// | ||
| 2 | -// AppCommonDefine.h | ||
| 3 | -// CNLiveNetAdd | ||
| 4 | -// | ||
| 5 | -// Created by 张旭 on 2018/1/2. | ||
| 6 | -// Copyright © 2018年 cnlive. All rights reserved. | ||
| 7 | -// | ||
| 8 | - | ||
| 9 | -#ifndef AppCommonDefine_h | ||
| 10 | -#define AppCommonDefine_h | ||
| 11 | - | ||
| 12 | -#ifndef CNLiveNetAddUrlSchems | ||
| 13 | -#define CNLiveNetAddUrlSchems @"CNLiveNetAddUrlSchems" // | ||
| 14 | -#endif | ||
| 15 | - | ||
| 16 | -#ifndef CNThirdPayBack | ||
| 17 | -#define CNThirdPayBack @"CNThirdPayBack" //三方支付返回标识 | ||
| 18 | -#endif | ||
| 19 | - | ||
| 20 | -#ifndef CNThirdPayOrderId | ||
| 21 | -#define CNThirdPayOrderId @"CNThirdPayOrderId" //三方支付订单Id | ||
| 22 | -#endif | ||
| 23 | - | ||
| 24 | -#ifndef CNDarenHomeSelectChangeNotification | ||
| 25 | -#define CNDarenHomeSelectChangeNotification @"CNDarenHomeSelectChangeNotification" //达人主页选择type 改变 | ||
| 26 | -#define CNAddGroupMemberNotification @"CNAddGroupMemberNotification" //添加群成员 | ||
| 27 | -#define CNDeleteGroupMemberNotification @"CNDeleteGroupMemberNotification" //删除群成功 | ||
| 28 | -#define CNMoviePlaybackStateChangeNotication @"CNMoviePlaybackStateChangeNotication" //播放状态发生改变 | ||
| 29 | -#define CNApplyRefundSuccessNotification @"CNApplyRefundSuccessNotification" //申请退款成功 | ||
| 30 | -#define CNEvaluateSuccessNotioncation @"CNEvaluateSuccessNotioncation" //评论成功 | ||
| 31 | -#define CNUpdateDefultAddressSuccessNotication @"CNUpdateDefultAddressSuccessNotication" //添加或修个收货地址成功 | ||
| 32 | -#define CNDeleteDefultAddressSuccessNotication @"CNDeleteDefultAddressSUccessNotication" //删除默认的收货地址 | ||
| 33 | -#define CNSendImageSuccessNotication @"CNSendImageSuccessNotication" //发送图片成功,更新UI | ||
| 34 | -#define CNRatatePortraitNotication @"CNRatatePortraitNotication" //全屏点击分享通知播放界面 由全屏变为竖屏 | ||
| 35 | -#endif | ||
| 36 | - | ||
| 37 | -//*** Native Classify | ||
| 38 | - | ||
| 39 | -//点击推荐页的栏目 跳转到对应栏目详细页 | ||
| 40 | -#define ChangeHomeChannel @"changeHomeChannel" | ||
| 41 | - | ||
| 42 | -//首页pagingView News类型的页面从屏幕上消失 news页面上的播放器同时消失 | ||
| 43 | -#define NewsPagingViewDisappear @"NewsPagingViewDisappear" | ||
| 44 | - | ||
| 45 | -#define OldChannelVersion @"OldChannelVersion" //首页频道列表版本号 | ||
| 46 | -#define NewChannelVersion @"NewChannelVersion" | ||
| 47 | - | ||
| 48 | -#define NormalChannelArray @"NormalChannelArray" //常用频道 | ||
| 49 | -#define OtherChannelArray @"OtherChannelArray" //其他频道 | ||
| 50 | - | ||
| 51 | -#define AppVersion [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"] //CFBundleShortVersionString | ||
| 52 | - | ||
| 53 | -//*** | ||
| 54 | - | ||
| 55 | -// 分类板块h5地址存储 | ||
| 56 | -#ifndef CNLiveNetAddCategoryChannels | ||
| 57 | -#define CNLiveNetAddCategoryChannels @"CNLiveNetAddCategoryChannels" | ||
| 58 | -#endif | ||
| 59 | -// App Store版本号存储 | ||
| 60 | -#ifndef CNLiveNetAddAppStoreVersionNumber | ||
| 61 | -#define CNLiveNetAddAppStoreVersionNumber @"CNLiveNetAddAppStoreVersionNumber" | ||
| 62 | -#endif | ||
| 63 | -//////////////////////////////////////////////////////// | ||
| 64 | -//////////// AppDelegate | ||
| 65 | -//////////////////////////////////////////////////////// | ||
| 66 | -#ifndef AppKeyWindow | ||
| 67 | -#define AppKeyWindow ((AppDelegate *)[UIApplication sharedApplication].delegate).window | ||
| 68 | -#endif | ||
| 69 | - | ||
| 70 | -#ifndef CNAppDelegate | ||
| 71 | -#define CNAppDelegate ((AppDelegate *)[UIApplication sharedApplication].delegate) | ||
| 72 | -#endif | ||
| 73 | - | ||
| 74 | - | ||
| 75 | -//////////////////////////////////////////////////////// | ||
| 76 | -//////////// function | ||
| 77 | -//////////////////////////////////////////////////////// | ||
| 78 | -#define isAllowChangeTheme 0 | ||
| 79 | - | ||
| 80 | - | ||
| 81 | -//////////////////////////////////////////////////////// | ||
| 82 | -//////////// SCreen | ||
| 83 | -//////////////////////////////////////////////////////// | ||
| 84 | -#define KScreenWidth ([UIScreen mainScreen].bounds.size.width > [UIScreen mainScreen].bounds.size.height ? [UIScreen mainScreen].bounds.size.height : [UIScreen mainScreen].bounds.size.width) | ||
| 85 | -#define KScreenHeight ([UIScreen mainScreen].bounds.size.width > [UIScreen mainScreen].bounds.size.height ? [UIScreen mainScreen].bounds.size.width : [UIScreen mainScreen].bounds.size.height) | ||
| 86 | - | ||
| 87 | - | ||
| 88 | -//判断iPHoneXr | ||
| 89 | -#define Device_Is_iPhoneXS_XR ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(828, 1792), [[UIScreen mainScreen] currentMode].size) : NO) | ||
| 90 | - | ||
| 91 | -//判断iPHoneX、iPHoneXs | ||
| 92 | -#define Device_Is_iPhoneX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO) | ||
| 93 | -#define Device_Is_iPhoneXS ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO) | ||
| 94 | - | ||
| 95 | -//判断iPhoneXs Max | ||
| 96 | -#define Device_Is_iPhoneXS_MAX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2688), [[UIScreen mainScreen] currentMode].size) : NO) | ||
| 97 | - | ||
| 98 | -#define IS_IPhoneX_All (CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(375, 812)) ||CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(812, 375)) ||CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(414, 896)) ||CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(896, 414))) | ||
| 99 | - | ||
| 100 | - | ||
| 101 | -#define kStatusHeight (int)[UIApplication sharedApplication].statusBarFrame.size.height //x44 非x20 | ||
| 102 | -#define kNavigationBarHeight ((int)[UIApplication sharedApplication].statusBarFrame.size.height+44) //x88 非x64 | ||
| 103 | -#define kVerticalNaviBarHeight ((IS_IPhoneX_All > 0) ? 88 : 44) | ||
| 104 | -#define kVerticalTabBarTotalHeight ((IS_IPhoneX_All > 0) ? 83 : 49) | ||
| 105 | -#define kVerticalBottomSafeHeight ((IS_IPhoneX_All > 0) ? 34 : 0) | ||
| 106 | -#define kVerticalStatusHeight ((IS_IPhoneX_All > 0) ? 44 : 20) | ||
| 107 | -#define kVerticalTopHeight ((IS_IPhoneX_All > 0) ? 24 : 0) | ||
| 108 | -#define kHorizontalTopNaviBarHeight 32 | ||
| 109 | -#define kHorizontalBottomHeight ((IS_IPhoneX_All > 0) ? 21 : 0) | ||
| 110 | -#define kHorizontalLeftHeight ((IS_IPhoneX_All > 0) ? 44 : 0) | ||
| 111 | -#define kHorizontalRightHeight ((IS_IPhoneX_All > 0) ? 44 : 0) | ||
| 112 | -#define kHorizontalTopHeight ((IS_IPhoneX_All > 0) ? 24 : 0) | ||
| 113 | -//////////////////////分类中直播点播横屏特用//////////////////////////// | ||
| 114 | -#define kLiveHorizontalTopHeight ((Device_Is_iPhoneX > 0) ? 6 : 0) | ||
| 115 | -#define kLiveHorizontalBottomHeight ((Device_Is_iPhoneX > 0) ? 11 : 0) | ||
| 116 | - | ||
| 117 | -//////////////////////////////////////////////////////// | ||
| 118 | -//////////// Font | ||
| 119 | -//////////////////////////////////////////////////////// | ||
| 120 | -#define kAppLargeTextFont [UIFont systemFontOfSize:16] | ||
| 121 | -#define kAppMiddleTextFont [UIFont systemFontOfSize:14] | ||
| 122 | -#define kAppSmallTextFont [UIFont systemFontOfSize:12] | ||
| 123 | - | ||
| 124 | -#define TopToolBarHeight (64.0 + IPhoneXSafeAreaInsets.bottom) | ||
| 125 | - | ||
| 126 | -//////////////////////////////////////////////////////// | ||
| 127 | -//////////// 发送图片,视频限制 | ||
| 128 | -//////////////////////////////////////////////////////// | ||
| 129 | -#define kFriendsCircle_limit_photo 20*1024.0*1024.0 //朋友圈限制图片20M | ||
| 130 | -#define kFirendsCircle_limit_video 30*1024.0*1024.0 //朋友圈限制视频30M | ||
| 131 | -#define kTarentoComment_limit_photo 10*1024.0*1024.0 //达人评论10M | ||
| 132 | -#define kSweepCode_limit_phoho 10*1024.0*1024.0 //扫码10M限制 | ||
| 133 | -#define kChat_limit_photo 20*1024.0*1024.0 //聊天限制图片20M | ||
| 134 | -#define kChat_limit_video 20*1024.0*1024.0 //聊天限制视频20M | ||
| 135 | - | ||
| 136 | -#define kChat_limit_video_length 5*60 //聊天限制视频5分钟 | ||
| 137 | -#define kFriendsCircle_limit_video_maxEdit 5*60 //朋友圈限制视频5分钟 | ||
| 138 | -#define kFriendsCircle_limit_video_max 10*60 //朋友圈限制最大视频编辑10分钟 | ||
| 139 | - | ||
| 140 | -//////////////////////////////////////////////////////// | ||
| 141 | -//////////// Color | ||
| 142 | -//////////////////////////////////////////////////////// | ||
| 143 | - | ||
| 144 | -#define RGBOF(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \ | ||
| 145 | -green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \ | ||
| 146 | -blue:((float)(rgbValue & 0xFF))/255.0 \ | ||
| 147 | -alpha:1.0] | ||
| 148 | - | ||
| 149 | -#define RGBA_OF(rgbValue) [UIColor colorWithRed:((float)(((rgbValue) & 0xFF000000) >> 24))/255.0 \ | ||
| 150 | -green:((float)(((rgbValue) & 0x00FF0000) >> 16))/255.0 \ | ||
| 151 | -blue:((float)(rgbValue & 0x0000FF00) >> 8)/255.0 \ | ||
| 152 | -alpha:((float)(rgbValue & 0x000000FF))/255.0] | ||
| 153 | - | ||
| 154 | -#define RGBAOF(v, a) [UIColor colorWithRed:((float)(((v) & 0xFF0000) >> 16))/255.0 \ | ||
| 155 | -green:((float)(((v) & 0x00FF00) >> 8))/255.0 \ | ||
| 156 | -blue:((float)(v & 0x0000FF))/255.0 \ | ||
| 157 | -alpha:a] | ||
| 158 | - | ||
| 159 | - | ||
| 160 | - | ||
| 161 | -#define RGBA(r,g,b,a) [UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:a] | ||
| 162 | -#define RGB(r,g,b) RGBA(r,g,b,1.0f) | ||
| 163 | -#define CommonBgColor [UIColor colorWithHexString:@"eeeeee"]; | ||
| 164 | - | ||
| 165 | -#define kDarenBgColor [UIColor colorWithRed:0.36 green:0.36 blue:0.36 alpha:1.00] | ||
| 166 | - | ||
| 167 | -#define kDarenGradeColor [UIColor colorWithRed:0.85 green:0.36 blue:0.10 alpha:1.00] | ||
| 168 | - | ||
| 169 | -#define kDarenYellowColor [UIColor colorWithRed:0.97 green:0.75 blue:0.03 alpha:1.00] | ||
| 170 | - | ||
| 171 | -#define kDarenGreenColor [UIColor colorWithRed:0.08 green:0.86 blue:0.52 alpha:1.00] | ||
| 172 | - | ||
| 173 | -#define kToolGrayColor [UIColor colorWithRed:0.94 green:0.94 blue:0.94 alpha:1.00] | ||
| 174 | - | ||
| 175 | -#define kCameraNextBtnGrayColor [UIColor colorWithRed:0.56 green:0.56 blue:0.56 alpha:1.00] | ||
| 176 | - | ||
| 177 | -#define kViewCommonGrayColor [UIColor colorWithRed:0.97 green:0.97 blue:0.97 alpha:1.00] | ||
| 178 | - | ||
| 179 | -#define kLineGrayColor [UIColor colorWithRed:0.95 green:0.95 blue:0.95 alpha:1.00] | ||
| 180 | -#define kLineBlueColor [UIColor colorWithRed:0.00 green:0.36 blue:1.00 alpha:1.00] | ||
| 181 | - | ||
| 182 | -#define kPublishRedColor [UIColor colorWithRed:0.88 green:0.10 blue:0.13 alpha:1.00] | ||
| 183 | - | ||
| 184 | -#define kPublishNaviRedColor [UIColor colorWithRed:1.00 green:0.17 blue:0.29 alpha:1.00] | ||
| 185 | - | ||
| 186 | -#define kNaviTintColor [UIColor colorWithRed:0.00 green:0.58 blue:1.00 alpha:1.00] | ||
| 187 | - | ||
| 188 | -#define kNaviThemeTintColor [UIColor colorWithRed:0.35 green:0.35 blue:0.35 alpha:1.00] | ||
| 189 | - | ||
| 190 | -#define kPublishSuccessColor [UIColor colorWithRed:0.21 green:1.00 blue:0.75 alpha:1.00] | ||
| 191 | - | ||
| 192 | -#define kPublishFailureColor [UIColor colorWithRed:1.00 green:0.00 blue:0.00 alpha:1.00] | ||
| 193 | - | ||
| 194 | -#define kMomentOrgangeColor [UIColor colorWithRed:0.98 green:0.55 blue:0.11 alpha:1.00] | ||
| 195 | - | ||
| 196 | -#define kMomentLineColor [UIColor colorWithRed:0.79 green:0.79 blue:0.79 alpha:1.00] | ||
| 197 | - | ||
| 198 | -///////正式 | ||
| 199 | -#define kBackGrayColor [UIColor colorWithRed:0.53 green:0.53 blue:0.53 alpha:1.00] | ||
| 200 | - | ||
| 201 | -#define kGuangbiaoColor [UIColor colorWithRed:0.20 green:0.35 blue:0.95 alpha:1.00] | ||
| 202 | - | ||
| 203 | -//////////////////////////////////////////////////////// | ||
| 204 | -//////////// firendCricle | ||
| 205 | -//////////////////////////////////////////////////////// | ||
| 206 | -#define contentLabelFontSize 16 | ||
| 207 | - | ||
| 208 | - | ||
| 209 | -//////////////////////////////////////////////////////// | ||
| 210 | -//////////// SystemVersion | ||
| 211 | -//////////////////////////////////////////////////////// | ||
| 212 | -#define iOS7Later ([UIDevice currentDevice].systemVersion.floatValue >= 7.0f) | ||
| 213 | -#define iOS8Later ([UIDevice currentDevice].systemVersion.floatValue >= 8.0f) | ||
| 214 | -#define iOS9Later ([UIDevice currentDevice].systemVersion.floatValue >= 9.0f) | ||
| 215 | -#define iOS9_1Later ([UIDevice currentDevice].systemVersion.floatValue >= 9.1f) | ||
| 216 | -#define iOS10Later ([UIDevice currentDevice].systemVersion.floatValue >= 10.0f) | ||
| 217 | - | ||
| 218 | - | ||
| 219 | -//////////////////////////////////////////////////////// | ||
| 220 | -//////////// WeakSelf&StrongSelf | ||
| 221 | -//////////////////////////////////////////////////////// | ||
| 222 | -/** | ||
| 223 | - * weakSelf | ||
| 224 | - */ | ||
| 225 | -#ifndef weakself | ||
| 226 | -#define weakself __weak typeof(self)weakSelf = self; | ||
| 227 | -#endif | ||
| 228 | -/** | ||
| 229 | - * strongSelf | ||
| 230 | - */ | ||
| 231 | -#ifndef strongself | ||
| 232 | -#define strongself __strong typeof(weakSelf)self = weakSelf; | ||
| 233 | -#endif | ||
| 234 | - | ||
| 235 | -//////////////////////////////////////////////////////// | ||
| 236 | -//////////// 输出测试 | ||
| 237 | -//////////////////////////////////////////////////////// | ||
| 238 | -#ifdef DEBUG | ||
| 239 | -#define NSLog(s, ... ) NSLog( @"[%@ in line %d] ===============>%@", [[NSString stringWithUTF8String:__FILE__] lastPathComponent], __LINE__, [NSString stringWithFormat:(s), ##__VA_ARGS__] ) | ||
| 240 | -#else | ||
| 241 | -#define NSLog(s, ... ) | ||
| 242 | -#endif | ||
| 243 | - | ||
| 244 | -//////////////////////////////////////////////////////// | ||
| 245 | -//////////// NSUserDefault | ||
| 246 | -//////////////////////////////////////////////////////// | ||
| 247 | -#ifndef CNUserIsLogin | ||
| 248 | -#define CNUserIsLogin @"CNUserIsLogin" | ||
| 249 | -#endif | ||
| 250 | - | ||
| 251 | -#ifndef CNUserInfo | ||
| 252 | -#define CNUserInfo @"CNUserInfo" | ||
| 253 | -#endif | ||
| 254 | - | ||
| 255 | -#ifndef kCNLiveUserDefaultsTingYunUIDKey | ||
| 256 | -#define kCNLiveUserDefaultsTingYunUIDKey @"kCNLiveUserDefaultsTingYunUIDKey" | ||
| 257 | -#endif | ||
| 258 | - | ||
| 259 | -#ifndef CNGroupListInfo // 某群组成员列表list | ||
| 260 | -#define CNGroupListInfo @"CNGroupListInfo" | ||
| 261 | -#endif | ||
| 262 | - | ||
| 263 | -#ifndef CNGroupsList // 群组列表list | ||
| 264 | -#define CNGroupsList @"CNGroupsList" | ||
| 265 | -#endif | ||
| 266 | - | ||
| 267 | -#ifndef CNRefundReason | ||
| 268 | -#define CNRefundReason @"CNRefundReason" | ||
| 269 | -#endif | ||
| 270 | - | ||
| 271 | -//////////////////////////////////////////////////////// | ||
| 272 | -//////////// Refresh | ||
| 273 | -//////////////////////////////////////////////////////// | ||
| 274 | -#define TableViewDefaultOffestHeight 64.f | ||
| 275 | - | ||
| 276 | -//////////////////////////IM//////////////////////////////// | ||
| 277 | -#pragma mark - IM | ||
| 278 | - | ||
| 279 | -#define kSaftyWordsCode 80001 | ||
| 280 | - | ||
| 281 | -// 是否支持富文本显示 | ||
| 282 | -#define kTestChatAttachment 1 | ||
| 283 | - | ||
| 284 | -//////////////////////////////////////////////////////// | ||
| 285 | -//////////// 动态跟随系统设置的字体大小改变字体和行高 | ||
| 286 | -//////////////////////////////////////////////////////// | ||
| 287 | -#define RATIO [CNSetUserDefaultTool getScaleCoefficient] | ||
| 288 | - | ||
| 289 | - | ||
| 290 | -//字体大小 | ||
| 291 | -#define Text_FONT(F) [UIFont systemFontOfSize:F] | ||
| 292 | - | ||
| 293 | -#define SINGLETON_FOR_HEADER(className) \ | ||
| 294 | -\ | ||
| 295 | -+ (className *)shared##className; | ||
| 296 | - | ||
| 297 | -#define SINGLETON_FOR_CLASS(className) \ | ||
| 298 | -\ | ||
| 299 | -+ (className *)shared##className { \ | ||
| 300 | -static className *shared##className = nil; \ | ||
| 301 | -static dispatch_once_t onceToken; \ | ||
| 302 | -dispatch_once(&onceToken, ^{ \ | ||
| 303 | -shared##className = [[self alloc] init]; \ | ||
| 304 | -}); \ | ||
| 305 | -return shared##className; \ | ||
| 306 | -} | ||
| 307 | - | ||
| 308 | -#endif /* AppCommonDefine_h */ |
CNLiveImagePickerController/CNImagePickerController.bundle/Root.plist deleted
100644 → 0
| 1 | -<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
| 3 | -<plist version="1.0"> | ||
| 4 | -<dict> | ||
| 5 | - <key>StringsTable</key> | ||
| 6 | - <string>Root</string> | ||
| 7 | - <key>PreferenceSpecifiers</key> | ||
| 8 | - <array> | ||
| 9 | - <dict> | ||
| 10 | - <key>Type</key> | ||
| 11 | - <string>PSGroupSpecifier</string> | ||
| 12 | - <key>Title</key> | ||
| 13 | - <string>Group</string> | ||
| 14 | - </dict> | ||
| 15 | - <dict> | ||
| 16 | - <key>Type</key> | ||
| 17 | - <string>PSTextFieldSpecifier</string> | ||
| 18 | - <key>Title</key> | ||
| 19 | - <string>Name</string> | ||
| 20 | - <key>Key</key> | ||
| 21 | - <string>name_preference</string> | ||
| 22 | - <key>DefaultValue</key> | ||
| 23 | - <string></string> | ||
| 24 | - <key>IsSecure</key> | ||
| 25 | - <false/> | ||
| 26 | - <key>KeyboardType</key> | ||
| 27 | - <string>Alphabet</string> | ||
| 28 | - <key>AutocapitalizationType</key> | ||
| 29 | - <string>None</string> | ||
| 30 | - <key>AutocorrectionType</key> | ||
| 31 | - <string>No</string> | ||
| 32 | - </dict> | ||
| 33 | - <dict> | ||
| 34 | - <key>Type</key> | ||
| 35 | - <string>PSToggleSwitchSpecifier</string> | ||
| 36 | - <key>Title</key> | ||
| 37 | - <string>Enabled</string> | ||
| 38 | - <key>Key</key> | ||
| 39 | - <string>enabled_preference</string> | ||
| 40 | - <key>DefaultValue</key> | ||
| 41 | - <true/> | ||
| 42 | - </dict> | ||
| 43 | - <dict> | ||
| 44 | - <key>Type</key> | ||
| 45 | - <string>PSSliderSpecifier</string> | ||
| 46 | - <key>Key</key> | ||
| 47 | - <string>slider_preference</string> | ||
| 48 | - <key>DefaultValue</key> | ||
| 49 | - <real>0.5</real> | ||
| 50 | - <key>MinimumValue</key> | ||
| 51 | - <integer>0</integer> | ||
| 52 | - <key>MaximumValue</key> | ||
| 53 | - <integer>1</integer> | ||
| 54 | - <key>MinimumValueImage</key> | ||
| 55 | - <string></string> | ||
| 56 | - <key>MaximumValueImage</key> | ||
| 57 | - <string></string> | ||
| 58 | - </dict> | ||
| 59 | - </array> | ||
| 60 | -</dict> | ||
| 61 | -</plist> |
CNLiveImagePickerController/CNImagePickerController.bundle/en.lproj/Root.strings deleted
100644 → 0
CNLiveImagePickerController/CNImagePickerController.m
| @@ -7,7 +7,8 @@ | @@ -7,7 +7,8 @@ | ||
| 7 | // | 7 | // |
| 8 | 8 | ||
| 9 | #import "CNImagePickerController.h" | 9 | #import "CNImagePickerController.h" |
| 10 | -#import "AppCommonDefine.h" | 10 | +#import "CNImagePickerCommonDefine.h" |
| 11 | +#import "UIImage+CNImagePicker.h" | ||
| 11 | 12 | ||
| 12 | @interface CNImagePickerController () | 13 | @interface CNImagePickerController () |
| 13 | 14 | ||
| @@ -21,12 +22,10 @@ | @@ -21,12 +22,10 @@ | ||
| 21 | } | 22 | } |
| 22 | 23 | ||
| 23 | /** | 24 | /** |
| 24 | - 配置 | 25 | + 配置 详情看TZImagePickerController |
| 25 | */ | 26 | */ |
| 26 | - (void)configTZImagePicker{ | 27 | - (void)configTZImagePicker{ |
| 27 | 28 | ||
| 28 | - // imagePickerVc.navigationBar.translucent = NO; | ||
| 29 | - | ||
| 30 | #pragma mark - 五类个性化设置,这些参数都可以不传,此时会走默认设置 | 29 | #pragma mark - 五类个性化设置,这些参数都可以不传,此时会走默认设置 |
| 31 | // 1.设置目前已经选中的图片数组 | 30 | // 1.设置目前已经选中的图片数组 |
| 32 | self.allowTakePicture = NO; // 在内部显示拍照按钮 | 31 | self.allowTakePicture = NO; // 在内部显示拍照按钮 |
| @@ -35,26 +34,15 @@ | @@ -35,26 +34,15 @@ | ||
| 35 | [self setUiImagePickerControllerSettingBlock:^(UIImagePickerController *imagePickerController) { | 34 | [self setUiImagePickerControllerSettingBlock:^(UIImagePickerController *imagePickerController) { |
| 36 | imagePickerController.videoQuality = UIImagePickerControllerQualityTypeHigh;//拍摄分辨率 | 35 | imagePickerController.videoQuality = UIImagePickerControllerQualityTypeHigh;//拍摄分辨率 |
| 37 | }]; | 36 | }]; |
| 38 | - // imagePickerVc.photoWidth = 1000; | ||
| 39 | - | ||
| 40 | - // 2. Set the appearance | ||
| 41 | - // 2. 在这里设置imagePickerVc的外观 | ||
| 42 | - // if (iOS7Later) { | ||
| 43 | - // imagePickerVc.navigationBar.barTintColor = [UIColor greenColor]; | ||
| 44 | - // } | ||
| 45 | - // imagePickerVc.oKButtonTitleColorDisabled = [UIColor lightGrayColor]; | ||
| 46 | - // imagePickerVc.oKButtonTitleColorNormal = [UIColor greenColor]; | ||
| 47 | - // imagePickerVc.navigationBar.translucent = NO; | ||
| 48 | - self.iconThemeColor = RGBOF(0x00BBE06);// 主体颜色 | 37 | + self.iconThemeColor = IP_RGBOF(0x00BBE06);// 主体颜色 |
| 49 | self.showPhotoCannotSelectLayer = YES;//达到上限是否有浮层 | 38 | self.showPhotoCannotSelectLayer = YES;//达到上限是否有浮层 |
| 50 | self.cannotSelectLayerColor = [[UIColor whiteColor] colorWithAlphaComponent:0.8];//设置达到上限的浮层 | 39 | self.cannotSelectLayerColor = [[UIColor whiteColor] colorWithAlphaComponent:0.8];//设置达到上限的浮层 |
| 51 | - self.photoDefImage = [UIImage imageNamed:@"photo_cell_normal"]; | ||
| 52 | -#pragma mark - TODO:RGBOF | ||
| 53 | -// self.photoSelImage = [UIImage qmui_imageWithColor:RGBOF(0x0BBE06) size:CGSizeMake(22, 22) cornerRadius:11]; | ||
| 54 | - self.photoOriginDefImage = [UIImage imageNamed:@"photo_original_nor"]; | ||
| 55 | 40 | ||
| 56 | - // 3. Set allow picking video & photo & originalPhoto or not | ||
| 57 | - // 3. 设置是否可以选择视频/图片/原图/gif(未开放) | 41 | + self.photoDefImage = [UIImage imageNamedFromMyBundle:@"photo_cell_normal"]; |
| 42 | + self.photoSelImage = [UIImage ip_imageWithColor:IP_RGBOF(0x0BBE06) size:CGSizeMake(22, 22) radius:11]; | ||
| 43 | + self.photoOriginDefImage = [UIImage imageNamedFromMyBundle:@"photo_original_nor"]; | ||
| 44 | + | ||
| 45 | + // 3. 设置是否可以选择视频/图片/原图/gif | ||
| 58 | self.allowPickingVideo = YES;// 显示视频 | 46 | self.allowPickingVideo = YES;// 显示视频 |
| 59 | self.allowPickingImage = YES;// 显示图片 | 47 | self.allowPickingImage = YES;// 显示图片 |
| 60 | self.allowPickingOriginalPhoto = YES; //显示原图 | 48 | self.allowPickingOriginalPhoto = YES; //显示原图 |
| @@ -97,17 +85,17 @@ | @@ -97,17 +85,17 @@ | ||
| 97 | 85 | ||
| 98 | self.showSelectedIndex = YES; // 设置是否显示图片序号 | 86 | self.showSelectedIndex = YES; // 设置是否显示图片序号 |
| 99 | 87 | ||
| 100 | - self.naviBgColor = RGBOF(0xFFFFFF);//导航栏颜色 | ||
| 101 | - self.naviTitleColor = RGBOF(0x282828);//相册title | ||
| 102 | - self.naviTitleFont = [UIFont fontWithName:@"PingFangSC-Medium" size:18];//title文字大小 | 88 | + self.naviBgColor = IP_RGBOF(0xFFFFFF);//导航栏颜色 |
| 89 | + self.naviTitleColor = IP_RGBOF(0x282828);//相册title | ||
| 90 | + self.naviTitleFont = [UIFont systemFontOfSize:18];//title文字大小 | ||
| 103 | [self setNavLeftBarButtonSettingBlock:^(UIButton *leftButton) {//设置返回按钮图标 | 91 | [self setNavLeftBarButtonSettingBlock:^(UIButton *leftButton) {//设置返回按钮图标 |
| 104 | - [leftButton setImage:[UIImage imageNamed:@"photo_back"] forState:UIControlStateNormal];//返回按钮图片 | 92 | + [leftButton setImage:[UIImage imageNamedFromMyBundle:@"photoback"] forState:UIControlStateNormal];//返回按钮图片 |
| 105 | [leftButton setTitle:@"返回" forState:UIControlStateNormal];//设置文字大小 | 93 | [leftButton setTitle:@"返回" forState:UIControlStateNormal];//设置文字大小 |
| 106 | - [leftButton setTitleColor:RGBOF(0x282828) forState:UIControlStateNormal];//设置文字颜色 | 94 | + [leftButton setTitleColor:IP_RGBOF(0x282828) forState:UIControlStateNormal];//设置文字颜色 |
| 107 | leftButton.titleLabel.font = [UIFont systemFontOfSize:15];//设置文字大小 | 95 | leftButton.titleLabel.font = [UIFont systemFontOfSize:15];//设置文字大小 |
| 108 | leftButton.imageEdgeInsets = UIEdgeInsetsMake(0, -7, 0, +7);//设置图片边缘 | 96 | leftButton.imageEdgeInsets = UIEdgeInsetsMake(0, -7, 0, +7);//设置图片边缘 |
| 109 | }]; | 97 | }]; |
| 110 | - self.barItemTextColor = RGBOF(0x282828);//设置barItem文字颜色 | 98 | + self.barItemTextColor = IP_RGBOF(0x282828);//设置barItem文字颜色 |
| 111 | self.barItemTextFont = [UIFont systemFontOfSize:15]; | 99 | self.barItemTextFont = [UIFont systemFontOfSize:15]; |
| 112 | 100 | ||
| 113 | // 设置首选语言 / Set preferred language | 101 | // 设置首选语言 / Set preferred language |
| @@ -121,24 +109,24 @@ | @@ -121,24 +109,24 @@ | ||
| 121 | [self setPhotoPickerPageUIConfigBlock:^(UICollectionView *collectionView, UIView *bottomToolBar, UIButton *previewButton, UIButton *originalPhotoButton, UILabel *originalPhotoLabel, UIButton *doneButton, UIImageView *numberImageView, UILabel *numberLabel, UIView *divideLine) { | 109 | [self setPhotoPickerPageUIConfigBlock:^(UICollectionView *collectionView, UIView *bottomToolBar, UIButton *previewButton, UIButton *originalPhotoButton, UILabel *originalPhotoLabel, UIButton *doneButton, UIImageView *numberImageView, UILabel *numberLabel, UIView *divideLine) { |
| 122 | 110 | ||
| 123 | //底部栏 | 111 | //底部栏 |
| 124 | - [bottomToolBar setBackgroundColor:RGBOF(0xFFFFFF)]; | 112 | + [bottomToolBar setBackgroundColor:IP_RGBOF(0xFFFFFF)]; |
| 125 | 113 | ||
| 126 | //预览 | 114 | //预览 |
| 127 | previewButton.titleLabel.font = [UIFont systemFontOfSize:16]; | 115 | previewButton.titleLabel.font = [UIFont systemFontOfSize:16]; |
| 128 | - [previewButton setTitleColor:RGBOF(0xB3B3B3) forState:UIControlStateDisabled];//禁用 | ||
| 129 | - [previewButton setTitleColor:RGBOF(0x000000) forState:UIControlStateNormal];//默认 | 116 | + [previewButton setTitleColor:IP_RGBOF(0xB3B3B3) forState:UIControlStateDisabled];//禁用 |
| 117 | + [previewButton setTitleColor:IP_RGBOF(0x000000) forState:UIControlStateNormal];//默认 | ||
| 130 | 118 | ||
| 131 | //原图按钮 | 119 | //原图按钮 |
| 132 | - [originalPhotoButton setImage:[UIImage imageNamed:@"photo_original_normal"] forState:UIControlStateDisabled];//禁用 | ||
| 133 | - [originalPhotoButton setImage:[UIImage imageNamed:@"photo_original_normal"] forState:UIControlStateNormal];//默认 | ||
| 134 | - [originalPhotoButton setImage:[UIImage imageNamed:@"photo_original_select"] forState:UIControlStateSelected];//选中 | 120 | + [originalPhotoButton setImage:[UIImage imageNamedFromMyBundle:@"photo_original_normal"] forState:UIControlStateDisabled];//禁用 |
| 121 | + [originalPhotoButton setImage:[UIImage imageNamedFromMyBundle:@"photo_original_normal"] forState:UIControlStateNormal];//默认 | ||
| 122 | + [originalPhotoButton setImage:[UIImage imageNamedFromMyBundle:@"photo_original_select"] forState:UIControlStateSelected];//选中 | ||
| 135 | originalPhotoButton.titleLabel.font = [UIFont systemFontOfSize:16]; | 123 | originalPhotoButton.titleLabel.font = [UIFont systemFontOfSize:16]; |
| 136 | - [originalPhotoButton setTitleColor:RGBOF(0xB3B3B3) forState:UIControlStateDisabled]; | ||
| 137 | - [originalPhotoButton setTitleColor:RGBOF(0x000000) forState:UIControlStateNormal]; | 124 | + [originalPhotoButton setTitleColor:IP_RGBOF(0xB3B3B3) forState:UIControlStateDisabled]; |
| 125 | + [originalPhotoButton setTitleColor:IP_RGBOF(0x000000) forState:UIControlStateNormal]; | ||
| 138 | 126 | ||
| 139 | //原图文字提示 | 127 | //原图文字提示 |
| 140 | - originalPhotoLabel.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:16]; | ||
| 141 | - originalPhotoLabel.textColor = RGBOF(0xB3B3B3); | 128 | + originalPhotoLabel.font = [UIFont systemFontOfSize:16]; |
| 129 | + originalPhotoLabel.textColor = IP_RGBOF(0xB3B3B3); | ||
| 142 | originalPhotoLabel.hidden = YES; | 130 | originalPhotoLabel.hidden = YES; |
| 143 | 131 | ||
| 144 | //选中提示 | 132 | //选中提示 |
| @@ -148,19 +136,19 @@ | @@ -148,19 +136,19 @@ | ||
| 148 | //完成按钮 | 136 | //完成按钮 |
| 149 | doneButton.titleLabel.font = [UIFont systemFontOfSize:13]; | 137 | doneButton.titleLabel.font = [UIFont systemFontOfSize:13]; |
| 150 | [doneButton setTitle:@"完成" forState:UIControlStateDisabled]; | 138 | [doneButton setTitle:@"完成" forState:UIControlStateDisabled]; |
| 151 | - [doneButton setTitleColor:RGBAOF(0xFFFFFF, 0.5) forState:UIControlStateDisabled]; | ||
| 152 | - [doneButton setTitleColor:RGBOF(0xFFFFFF) forState:UIControlStateNormal]; | 139 | + [doneButton setTitleColor:IP_RGBAOF(0xFFFFFF, 0.5) forState:UIControlStateDisabled]; |
| 140 | + [doneButton setTitleColor:IP_RGBOF(0xFFFFFF) forState:UIControlStateNormal]; | ||
| 153 | 141 | ||
| 154 | //颜色绘制成图片 | 142 | //颜色绘制成图片 |
| 155 | -// UIImage *dis_image = [UIImage qmui_imageWithColor:RGBAOF(0x0BBE06, 0.5)]; | ||
| 156 | -// [doneButton setBackgroundImage:dis_image forState:UIControlStateDisabled]; | ||
| 157 | -// UIImage *nor_image = [UIImage qmui_imageWithColor:RGBOF(0x0BBE06)]; | ||
| 158 | -// [doneButton setBackgroundImage:nor_image forState:UIControlStateNormal]; | 143 | + UIImage *dis_image = [UIImage ip_imageWithColor:IP_RGBAOF(0x0BBE06, 0.5)]; |
| 144 | + [doneButton setBackgroundImage:dis_image forState:UIControlStateDisabled]; | ||
| 145 | + UIImage *nor_image = [UIImage ip_imageWithColor:IP_RGBOF(0x0BBE06)]; | ||
| 146 | + [doneButton setBackgroundImage:nor_image forState:UIControlStateNormal]; | ||
| 159 | doneButton.layer.masksToBounds = YES; | 147 | doneButton.layer.masksToBounds = YES; |
| 160 | doneButton.layer.cornerRadius = 5; | 148 | doneButton.layer.cornerRadius = 5; |
| 161 | 149 | ||
| 162 | //分割线 | 150 | //分割线 |
| 163 | - [divideLine setBackgroundColor:RGBOF(0xDEDEDE)]; | 151 | + [divideLine setBackgroundColor:IP_RGBOF(0xDEDEDE)]; |
| 164 | 152 | ||
| 165 | }]; | 153 | }]; |
| 166 | 154 | ||
| @@ -168,33 +156,33 @@ | @@ -168,33 +156,33 @@ | ||
| 168 | [self setPhotoPreviewPageUIConfigBlock:^(UICollectionView *collectionView, UIView *naviBar, UIButton *backButton, UIButton *selectButton, UILabel *indexLabel, UIView *toolBar, UIButton *originalPhotoButton, UILabel *originalPhotoLabel, UIButton *doneButton, UIImageView *numberImageView, UILabel *numberLabel) { | 156 | [self setPhotoPreviewPageUIConfigBlock:^(UICollectionView *collectionView, UIView *naviBar, UIButton *backButton, UIButton *selectButton, UILabel *indexLabel, UIView *toolBar, UIButton *originalPhotoButton, UILabel *originalPhotoLabel, UIButton *doneButton, UIImageView *numberImageView, UILabel *numberLabel) { |
| 169 | 157 | ||
| 170 | //返回按钮 | 158 | //返回按钮 |
| 171 | - [backButton setImage:[UIImage imageNamed:@"photo_original_back"] forState:UIControlStateNormal]; | 159 | + [backButton setImage:[UIImage imageNamedFromMyBundle:@"photo_original_back"] forState:UIControlStateNormal]; |
| 172 | //选择按钮 | 160 | //选择按钮 |
| 173 | - [selectButton setImage:[UIImage imageNamed:@"photo_original_nor"] forState:UIControlStateNormal]; | ||
| 174 | -// [selectButton setImage:[UIImage qmui_imageWithColor:RGBOF(0x0BBE06) size:CGSizeMake(28, 28) cornerRadius:14] forState:UIControlStateSelected]; | 161 | + [selectButton setImage:[UIImage imageNamedFromMyBundle:@"photo_original_nor"] forState:UIControlStateNormal]; |
| 162 | + [selectButton setImage:[UIImage ip_imageWithColor:IP_RGBOF(0x0BBE06) size:CGSizeMake(28, 28) radius:14] forState:UIControlStateSelected]; | ||
| 175 | [selectButton setTitle:@"" forState:UIControlStateDisabled]; | 163 | [selectButton setTitle:@"" forState:UIControlStateDisabled]; |
| 176 | 164 | ||
| 177 | //原图按钮 | 165 | //原图按钮 |
| 178 | - [originalPhotoButton setImage:[UIImage imageNamed:@"photo_original_normal"] forState:UIControlStateDisabled];//禁用 | ||
| 179 | - [originalPhotoButton setImage:[UIImage imageNamed:@"photo_original_normal"] forState:UIControlStateNormal];//默认 | ||
| 180 | - [originalPhotoButton setImage:[UIImage imageNamed:@"photo_original_select"] forState:UIControlStateSelected];//选中 | 166 | + [originalPhotoButton setImage:[UIImage imageNamedFromMyBundle:@"photo_original_normal"] forState:UIControlStateDisabled];//禁用 |
| 167 | + [originalPhotoButton setImage:[UIImage imageNamedFromMyBundle:@"photo_original_normal"] forState:UIControlStateNormal];//默认 | ||
| 168 | + [originalPhotoButton setImage:[UIImage imageNamedFromMyBundle:@"photo_original_select"] forState:UIControlStateSelected];//选中 | ||
| 181 | originalPhotoButton.titleLabel.font = [UIFont systemFontOfSize:16]; | 169 | originalPhotoButton.titleLabel.font = [UIFont systemFontOfSize:16]; |
| 182 | - [originalPhotoButton setTitleColor:RGBOF(0xB3B3B3) forState:UIControlStateDisabled]; | ||
| 183 | - [originalPhotoButton setTitleColor:RGBAOF(0xFFFFFF, 0.7) forState:UIControlStateNormal]; | 170 | + [originalPhotoButton setTitleColor:IP_RGBOF(0xB3B3B3) forState:UIControlStateDisabled]; |
| 171 | + [originalPhotoButton setTitleColor:IP_RGBAOF(0xFFFFFF, 0.7) forState:UIControlStateNormal]; | ||
| 184 | //原图内容隐藏 | 172 | //原图内容隐藏 |
| 185 | originalPhotoLabel.hidden = YES; | 173 | originalPhotoLabel.hidden = YES; |
| 186 | 174 | ||
| 187 | //完成按钮 | 175 | //完成按钮 |
| 188 | doneButton.titleLabel.font = [UIFont systemFontOfSize:13]; | 176 | doneButton.titleLabel.font = [UIFont systemFontOfSize:13]; |
| 189 | [doneButton setTitle:@"完成" forState:UIControlStateDisabled]; | 177 | [doneButton setTitle:@"完成" forState:UIControlStateDisabled]; |
| 190 | - [doneButton setTitleColor:RGBOF(0xFFFFFF) forState:UIControlStateDisabled]; | ||
| 191 | - [doneButton setTitleColor:RGBOF(0xFFFFFF) forState:UIControlStateNormal]; | 178 | + [doneButton setTitleColor:IP_RGBOF(0xFFFFFF) forState:UIControlStateDisabled]; |
| 179 | + [doneButton setTitleColor:IP_RGBOF(0xFFFFFF) forState:UIControlStateNormal]; | ||
| 192 | 180 | ||
| 193 | //颜色绘制成图片 | 181 | //颜色绘制成图片 |
| 194 | -// UIImage *dis_image = [UIImage qmui_imageWithColor:RGBAOF(0x0BBE06, 0.5)]; | ||
| 195 | -// [doneButton setBackgroundImage:dis_image forState:UIControlStateSelected]; | ||
| 196 | -// UIImage *nor_image = [UIImage qmui_imageWithColor:RGBOF(0x0BBE06)]; | ||
| 197 | -// [doneButton setBackgroundImage:nor_image forState:UIControlStateNormal]; | 182 | + UIImage *dis_image = [UIImage ip_imageWithColor:IP_RGBAOF(0x0BBE06, 0.5)]; |
| 183 | + [doneButton setBackgroundImage:dis_image forState:UIControlStateSelected]; | ||
| 184 | + UIImage *nor_image = [UIImage ip_imageWithColor:IP_RGBOF(0x0BBE06)]; | ||
| 185 | + [doneButton setBackgroundImage:nor_image forState:UIControlStateNormal]; | ||
| 198 | doneButton.layer.masksToBounds = YES; | 186 | doneButton.layer.masksToBounds = YES; |
| 199 | doneButton.layer.cornerRadius = 5; | 187 | doneButton.layer.cornerRadius = 5; |
| 200 | }]; | 188 | }]; |
| @@ -205,14 +193,14 @@ | @@ -205,14 +193,14 @@ | ||
| 205 | //完成按钮 | 193 | //完成按钮 |
| 206 | doneButton.titleLabel.font = [UIFont systemFontOfSize:13]; | 194 | doneButton.titleLabel.font = [UIFont systemFontOfSize:13]; |
| 207 | [doneButton setTitle:@"完成" forState:UIControlStateDisabled]; | 195 | [doneButton setTitle:@"完成" forState:UIControlStateDisabled]; |
| 208 | - [doneButton setTitleColor:RGBOF(0xFFFFFF) forState:UIControlStateDisabled]; | ||
| 209 | - [doneButton setTitleColor:RGBOF(0xFFFFFF) forState:UIControlStateNormal]; | 196 | + [doneButton setTitleColor:IP_RGBOF(0xFFFFFF) forState:UIControlStateDisabled]; |
| 197 | + [doneButton setTitleColor:IP_RGBOF(0xFFFFFF) forState:UIControlStateNormal]; | ||
| 210 | 198 | ||
| 211 | //颜色绘制成图片 | 199 | //颜色绘制成图片 |
| 212 | -// UIImage *dis_image = [UIImage qmui_imageWithColor:RGBAOF(0x0BBE06, 0.5)]; | ||
| 213 | -// [doneButton setBackgroundImage:dis_image forState:UIControlStateSelected]; | ||
| 214 | -// UIImage *nor_image = [UIImage qmui_imageWithColor:RGBOF(0x0BBE06)]; | ||
| 215 | -// [doneButton setBackgroundImage:nor_image forState:UIControlStateNormal]; | 200 | + UIImage *dis_image = [UIImage ip_imageWithColor:IP_RGBAOF(0x0BBE06, 0.5)]; |
| 201 | + [doneButton setBackgroundImage:dis_image forState:UIControlStateSelected]; | ||
| 202 | + UIImage *nor_image = [UIImage ip_imageWithColor:IP_RGBOF(0x0BBE06)]; | ||
| 203 | + [doneButton setBackgroundImage:nor_image forState:UIControlStateNormal]; | ||
| 216 | doneButton.layer.masksToBounds = YES; | 204 | doneButton.layer.masksToBounds = YES; |
| 217 | doneButton.layer.cornerRadius = 5; | 205 | doneButton.layer.cornerRadius = 5; |
| 218 | 206 | ||
| @@ -224,14 +212,14 @@ | @@ -224,14 +212,14 @@ | ||
| 224 | //完成按钮 | 212 | //完成按钮 |
| 225 | doneButton.titleLabel.font = [UIFont systemFontOfSize:13]; | 213 | doneButton.titleLabel.font = [UIFont systemFontOfSize:13]; |
| 226 | [doneButton setTitle:@"完成" forState:UIControlStateDisabled]; | 214 | [doneButton setTitle:@"完成" forState:UIControlStateDisabled]; |
| 227 | - [doneButton setTitleColor:RGBOF(0xFFFFFF) forState:UIControlStateDisabled]; | ||
| 228 | - [doneButton setTitleColor:RGBOF(0xFFFFFF) forState:UIControlStateNormal]; | 215 | + [doneButton setTitleColor:IP_RGBOF(0xFFFFFF) forState:UIControlStateDisabled]; |
| 216 | + [doneButton setTitleColor:IP_RGBOF(0xFFFFFF) forState:UIControlStateNormal]; | ||
| 229 | 217 | ||
| 230 | //颜色绘制成图片 | 218 | //颜色绘制成图片 |
| 231 | -// UIImage *dis_image = [UIImage qmui_imageWithColor:RGBAOF(0x0BBE06, 0.5)]; | ||
| 232 | -// [doneButton setBackgroundImage:dis_image forState:UIControlStateSelected]; | ||
| 233 | -// UIImage *nor_image = [UIImage qmui_imageWithColor:RGBOF(0x0BBE06)]; | ||
| 234 | -// [doneButton setBackgroundImage:nor_image forState:UIControlStateNormal]; | 219 | + UIImage *dis_image = [UIImage ip_imageWithColor:IP_RGBAOF(0x0BBE06, 0.5)]; |
| 220 | + [doneButton setBackgroundImage:dis_image forState:UIControlStateSelected]; | ||
| 221 | + UIImage *nor_image = [UIImage ip_imageWithColor:IP_RGBOF(0x0BBE06)]; | ||
| 222 | + [doneButton setBackgroundImage:nor_image forState:UIControlStateNormal]; | ||
| 235 | doneButton.layer.masksToBounds = YES; | 223 | doneButton.layer.masksToBounds = YES; |
| 236 | doneButton.layer.cornerRadius = 5; | 224 | doneButton.layer.cornerRadius = 5; |
| 237 | 225 |
CNLiveImagePickerController/CNImagePickerManager.m
| @@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
| 8 | 8 | ||
| 9 | #import "CNImagePickerManager.h" | 9 | #import "CNImagePickerManager.h" |
| 10 | #import <AssetsLibrary/AssetsLibrary.h> | 10 | #import <AssetsLibrary/AssetsLibrary.h> |
| 11 | -#import "AppCommonDefine.h" | 11 | +#import "CNImagePickerCommonDefine.h" |
| 12 | 12 | ||
| 13 | @implementation CNImagePickerManager | 13 | @implementation CNImagePickerManager |
| 14 | 14 | ||
| @@ -37,6 +37,8 @@ | @@ -37,6 +37,8 @@ | ||
| 37 | 37 | ||
| 38 | break; | 38 | break; |
| 39 | case CNImagePickerEnterTypeChat: | 39 | case CNImagePickerEnterTypeChat: |
| 40 | + imagePickerVc.maxEditVideoTime = kFriendsCircle_limit_video_maxEdit;//编辑长度 | ||
| 41 | + imagePickerVc.maxVideoDuration = kChat_limit_video_length;//编辑视频最大长度 | ||
| 40 | 42 | ||
| 41 | break; | 43 | break; |
| 42 | case CNImagePickerEnterTypeWitness: | 44 | case CNImagePickerEnterTypeWitness: |
CNLiveImagePickerController/TZImageManager.h
| @@ -23,9 +23,10 @@ | @@ -23,9 +23,10 @@ | ||
| 23 | 23 | ||
| 24 | @property (weak, nonatomic) id<TZImagePickerControllerDelegate> pickerDelegate; | 24 | @property (weak, nonatomic) id<TZImagePickerControllerDelegate> pickerDelegate; |
| 25 | 25 | ||
| 26 | -#pragma mark - 添加: 原有逻辑-会话id(LXG) | ||
| 27 | -//zl__会话Id用于视频导出路径 | ||
| 28 | -@property (nonatomic, strong) NSString *conversationId; | 26 | +#pragma mark - ADD: 原有逻辑-会话id(LXG) |
| 27 | + | ||
| 28 | +/// 导出路径 | ||
| 29 | +@property (nonatomic, copy) NSString *outputPath; | ||
| 29 | 30 | ||
| 30 | @property (nonatomic, assign) BOOL shouldFixOrientation; | 31 | @property (nonatomic, assign) BOOL shouldFixOrientation; |
| 31 | 32 |
CNLiveImagePickerController/TZImageManager.m
| @@ -864,19 +864,15 @@ static dispatch_once_t onceToken; | @@ -864,19 +864,15 @@ static dispatch_once_t onceToken; | ||
| 864 | 864 | ||
| 865 | NSDateFormatter *formater = [[NSDateFormatter alloc] init]; | 865 | NSDateFormatter *formater = [[NSDateFormatter alloc] init]; |
| 866 | [formater setDateFormat:@"yyyy-MM-dd-HH:mm:ss-SSS"]; | 866 | [formater setDateFormat:@"yyyy-MM-dd-HH:mm:ss-SSS"]; |
| 867 | -#pragma mark - TODO: 添加: 原有逻辑-根据会话id取得path(LXG) | ||
| 868 | - NSString *filaName = [NSString stringWithFormat:@"output-%@_fileType=videoType.mp4",[formater stringFromDate:[NSDate date]]]; | ||
| 869 | -// NSString *outputPath = [NSHomeDirectory() stringByAppendingFormat:@"/tmp/output-%@.mp4", [formater stringFromDate:[NSDate date]]]; | 867 | +#pragma mark - ADD: 原有逻辑-根据会话id取得path(LXG) |
| 870 | NSString *outputPath = @""; | 868 | NSString *outputPath = @""; |
| 871 | - if (self.conversationId) { | ||
| 872 | -// outputPath = [[CNTools newChatFilePathByUserId:self.conversationId] stringByAppendingPathComponent:filaName];//聊天 | ||
| 873 | -// | ||
| 874 | - } | ||
| 875 | - else | ||
| 876 | - { | ||
| 877 | - | ||
| 878 | -// outputPath = [[CNTools chatFilePathByUserId:[IMAPlatform sharedInstance].host.userId] stringByAppendingString:filaName];//朋友圈 | 869 | + if (self.outputPath.length <= 0) { |
| 870 | + outputPath = [NSHomeDirectory() stringByAppendingFormat:@"/tmp/output-%@.mp4", [formater stringFromDate:[NSDate date]]]; | ||
| 871 | + }else { | ||
| 872 | + NSString *filaName = [NSString stringWithFormat:@"output-%@_fileType=videoType.mp4",[formater stringFromDate:[NSDate date]]]; | ||
| 873 | + outputPath = [self.outputPath stringByAppendingString:filaName]; | ||
| 879 | } | 874 | } |
| 875 | + | ||
| 880 | NSLog(@"video outputPath = %@",outputPath); | 876 | NSLog(@"video outputPath = %@",outputPath); |
| 881 | 877 | ||
| 882 | session.outputURL = [NSURL fileURLWithPath:outputPath]; | 878 | session.outputURL = [NSURL fileURLWithPath:outputPath]; |
| @@ -910,8 +906,7 @@ static dispatch_once_t onceToken; | @@ -910,8 +906,7 @@ static dispatch_once_t onceToken; | ||
| 910 | } | 906 | } |
| 911 | 907 | ||
| 912 | // Begin to export video to the output path asynchronously. | 908 | // Begin to export video to the output path asynchronously. |
| 913 | -#pragma mark - 添加: 原有逻辑-会话id置空(LXG) | ||
| 914 | - self.conversationId = nil; | 909 | +#pragma mark - ADD: 原有逻辑-会话id置空(LXG) |
| 915 | [session exportAsynchronouslyWithCompletionHandler:^(void) { | 910 | [session exportAsynchronouslyWithCompletionHandler:^(void) { |
| 916 | dispatch_async(dispatch_get_main_queue(), ^{ | 911 | dispatch_async(dispatch_get_main_queue(), ^{ |
| 917 | 912 |
CNLiveImagePickerController/TZImagePickerController.bundle/photo_cell_normal.png
0 → 100644
641 Bytes
CNLiveImagePickerController/TZImagePickerController.bundle/photo_cell_normal@2x.png
0 → 100644
1.35 KB
CNLiveImagePickerController/TZImagePickerController.bundle/photo_cell_normal@3x.png
0 → 100644
2.57 KB
CNLiveImagePickerController/TZImagePickerController.bundle/photo_original_back.png
0 → 100644
234 Bytes
CNLiveImagePickerController/TZImagePickerController.bundle/photo_original_back@2x.png
0 → 100644
384 Bytes
CNLiveImagePickerController/TZImagePickerController.bundle/photo_original_back@3x.png
0 → 100644
726 Bytes
CNLiveImagePickerController/TZImagePickerController.bundle/photo_original_nor.png
0 → 100644
1.04 KB
CNLiveImagePickerController/TZImagePickerController.bundle/photo_original_nor@2x.png
0 → 100644
2.12 KB
CNLiveImagePickerController/TZImagePickerController.bundle/photo_original_nor@3x.png
0 → 100644
6.27 KB
CNLiveImagePickerController/TZImagePickerController.bundle/photo_original_normal.png
0 → 100644
453 Bytes
CNLiveImagePickerController/TZImagePickerController.bundle/photo_original_normal@2x.png
0 → 100644
902 Bytes
CNLiveImagePickerController/TZImagePickerController.bundle/photo_original_normal@3x.png
0 → 100644
1.77 KB
CNLiveImagePickerController/TZImagePickerController.bundle/photo_original_select.png
0 → 100644
713 Bytes
CNLiveImagePickerController/TZImagePickerController.bundle/photo_original_select@2x.png
0 → 100644
1.31 KB
CNLiveImagePickerController/TZImagePickerController.bundle/photo_original_select@3x.png
0 → 100644
3.56 KB
CNLiveImagePickerController/TZImagePickerController.bundle/photoback.png
0 → 100644
1.01 KB
CNLiveImagePickerController/TZImagePickerController.bundle/photoback@2x.png
0 → 100644
1.16 KB
CNLiveImagePickerController/TZImagePickerController.bundle/photoback@3x.png
0 → 100644
1.23 KB
CNLiveImagePickerController/TZImagePickerController.bundle/video_edit_left@2x.png
0 → 100644
203 Bytes
CNLiveImagePickerController/TZImagePickerController.bundle/video_edit_left@3x.png
0 → 100644
514 Bytes
CNLiveImagePickerController/TZImagePickerController.bundle/video_edit_right@2x.png
0 → 100644
208 Bytes
CNLiveImagePickerController/TZImagePickerController.bundle/video_edit_right@3x.png
0 → 100644
502 Bytes
CNLiveImagePickerController/TZImagePickerController.h
CNLiveImagePickerController/TZImagePickerController.m
| @@ -165,7 +165,7 @@ | @@ -165,7 +165,7 @@ | ||
| 165 | self.pickerDelegate = delegate; | 165 | self.pickerDelegate = delegate; |
| 166 | self.selectedAssets = [NSMutableArray array]; | 166 | self.selectedAssets = [NSMutableArray array]; |
| 167 | 167 | ||
| 168 | -#pragma mark - 添加:视频编辑(LXG) | 168 | +#pragma mark - ADD:视频编辑(LXG) |
| 169 | self.maxEditVideoTime = 10; | 169 | self.maxEditVideoTime = 10; |
| 170 | self.maxVideoDuration = 120; | 170 | self.maxVideoDuration = 120; |
| 171 | // Allow user picking original photo and video, you also can set No after this method | 171 | // Allow user picking original photo and video, you also can set No after this method |
CNLiveImagePickerController/TZPhotoPickerController.m
| @@ -254,7 +254,7 @@ static CGFloat itemMargin = 5; | @@ -254,7 +254,7 @@ static CGFloat itemMargin = 5; | ||
| 254 | _numberLabel.text = [NSString stringWithFormat:@"%zd",tzImagePickerVc.selectedModels.count]; | 254 | _numberLabel.text = [NSString stringWithFormat:@"%zd",tzImagePickerVc.selectedModels.count]; |
| 255 | _numberLabel.hidden = tzImagePickerVc.selectedModels.count <= 0; | 255 | _numberLabel.hidden = tzImagePickerVc.selectedModels.count <= 0; |
| 256 | _numberLabel.backgroundColor = [UIColor clearColor]; | 256 | _numberLabel.backgroundColor = [UIColor clearColor]; |
| 257 | -#pragma mark - 添加: 选择图片个数显示(LXG) | 257 | +#pragma mark - ADD: 选择图片个数显示(LXG) |
| 258 | _numberImageView.hidden = YES; | 258 | _numberImageView.hidden = YES; |
| 259 | _numberLabel.hidden = YES; | 259 | _numberLabel.hidden = YES; |
| 260 | [_doneButton setTitle:[NSString stringWithFormat:@"完成(%zd)",tzImagePickerVc.selectedModels.count] forState:UIControlStateNormal]; | 260 | [_doneButton setTitle:[NSString stringWithFormat:@"完成(%zd)",tzImagePickerVc.selectedModels.count] forState:UIControlStateNormal]; |
| @@ -788,7 +788,7 @@ static CGFloat itemMargin = 5; | @@ -788,7 +788,7 @@ static CGFloat itemMargin = 5; | ||
| 788 | _numberImageView.hidden = tzImagePickerVc.selectedModels.count <= 0; | 788 | _numberImageView.hidden = tzImagePickerVc.selectedModels.count <= 0; |
| 789 | _numberLabel.hidden = tzImagePickerVc.selectedModels.count <= 0; | 789 | _numberLabel.hidden = tzImagePickerVc.selectedModels.count <= 0; |
| 790 | _numberLabel.text = [NSString stringWithFormat:@"%zd",tzImagePickerVc.selectedModels.count]; | 790 | _numberLabel.text = [NSString stringWithFormat:@"%zd",tzImagePickerVc.selectedModels.count]; |
| 791 | -#pragma mark - 添加: 选择图片个数显示(LXG) | 791 | +#pragma mark - ADD: 选择图片个数显示(LXG) |
| 792 | _numberImageView.hidden = YES; | 792 | _numberImageView.hidden = YES; |
| 793 | _numberLabel.hidden = YES; | 793 | _numberLabel.hidden = YES; |
| 794 | [_doneButton setTitle:[NSString stringWithFormat:@"完成(%zd)",tzImagePickerVc.selectedModels.count] forState:UIControlStateNormal]; | 794 | [_doneButton setTitle:[NSString stringWithFormat:@"完成(%zd)",tzImagePickerVc.selectedModels.count] forState:UIControlStateNormal]; |
CNLiveImagePickerController/TZPhotoPreviewController.m
| @@ -208,7 +208,7 @@ | @@ -208,7 +208,7 @@ | ||
| 208 | _numberLabel.text = [NSString stringWithFormat:@"%zd",_tzImagePickerVc.selectedModels.count]; | 208 | _numberLabel.text = [NSString stringWithFormat:@"%zd",_tzImagePickerVc.selectedModels.count]; |
| 209 | _numberLabel.hidden = _tzImagePickerVc.selectedModels.count <= 0; | 209 | _numberLabel.hidden = _tzImagePickerVc.selectedModels.count <= 0; |
| 210 | _numberLabel.backgroundColor = [UIColor clearColor]; | 210 | _numberLabel.backgroundColor = [UIColor clearColor]; |
| 211 | -#pragma mark - 添加: 选择图片个数显示(LXG) | 211 | +#pragma mark - ADD: 选择图片个数显示(LXG) |
| 212 | _numberImageView.hidden = YES; | 212 | _numberImageView.hidden = YES; |
| 213 | _numberLabel.hidden = YES; | 213 | _numberLabel.hidden = YES; |
| 214 | NSString *titleStr = _tzImagePickerVc.selectedModels.count > 0 ? [NSString stringWithFormat:@"完成(%zd)",_tzImagePickerVc.selectedModels.count] : @"完成"; | 214 | NSString *titleStr = _tzImagePickerVc.selectedModels.count > 0 ? [NSString stringWithFormat:@"完成(%zd)",_tzImagePickerVc.selectedModels.count] : @"完成"; |
| @@ -627,7 +627,7 @@ | @@ -627,7 +627,7 @@ | ||
| 627 | _numberLabel.text = [NSString stringWithFormat:@"%zd",_tzImagePickerVc.selectedModels.count]; | 627 | _numberLabel.text = [NSString stringWithFormat:@"%zd",_tzImagePickerVc.selectedModels.count]; |
| 628 | _numberImageView.hidden = (_tzImagePickerVc.selectedModels.count <= 0 || _isHideNaviBar || _isCropImage); | 628 | _numberImageView.hidden = (_tzImagePickerVc.selectedModels.count <= 0 || _isHideNaviBar || _isCropImage); |
| 629 | _numberLabel.hidden = (_tzImagePickerVc.selectedModels.count <= 0 || _isHideNaviBar || _isCropImage); | 629 | _numberLabel.hidden = (_tzImagePickerVc.selectedModels.count <= 0 || _isHideNaviBar || _isCropImage); |
| 630 | -#pragma mark - 添加: 选择图片个数显示(LXG) | 630 | +#pragma mark - ADD: 选择图片个数显示(LXG) |
| 631 | //隐藏图标 | 631 | //隐藏图标 |
| 632 | _numberLabel.hidden = YES; | 632 | _numberLabel.hidden = YES; |
| 633 | _numberImageView.hidden = YES; | 633 | _numberImageView.hidden = YES; |
| @@ -661,7 +661,7 @@ | @@ -661,7 +661,7 @@ | ||
| 661 | _doneButton.hidden = YES; | 661 | _doneButton.hidden = YES; |
| 662 | } | 662 | } |
| 663 | 663 | ||
| 664 | -#pragma mark - 添加: 视频显示操作(LXG) | 664 | +#pragma mark - ADD: 视频显示操作(LXG) |
| 665 | //多选状态下**不允许**图片和视频混选 | 665 | //多选状态下**不允许**图片和视频混选 |
| 666 | if (!_tzImagePickerVc.allowPickingMultipleVideo) { | 666 | if (!_tzImagePickerVc.allowPickingMultipleVideo) { |
| 667 | 667 |
CNLiveImagePickerController/TZVideoPlayerController.m
| @@ -49,7 +49,7 @@ | @@ -49,7 +49,7 @@ | ||
| 49 | [self configMoviePlayer]; | 49 | [self configMoviePlayer]; |
| 50 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pausePlayerAndShowNaviBar) name:UIApplicationWillResignActiveNotification object:nil]; | 50 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pausePlayerAndShowNaviBar) name:UIApplicationWillResignActiveNotification object:nil]; |
| 51 | } | 51 | } |
| 52 | -#pragma mark - 添加: 导航栏(LXG) | 52 | +#pragma mark - ADD: 导航栏(LXG) |
| 53 | - (void)viewWillAppear:(BOOL)animated { | 53 | - (void)viewWillAppear:(BOOL)animated { |
| 54 | [super viewWillAppear:animated]; | 54 | [super viewWillAppear:animated]; |
| 55 | _originStatusBarStyle = [UIApplication sharedApplication].statusBarStyle; | 55 | _originStatusBarStyle = [UIApplication sharedApplication].statusBarStyle; |
CNLiveImagePickerController/utils/CNImagePickerCommonDefine.h
0 → 100644
| 1 | +// | ||
| 2 | +// CNImagePickerCommonDefine.h | ||
| 3 | +// CNLiveImagePickerControllerExample | ||
| 4 | +// | ||
| 5 | +// Created by 梁星国 on 2018/10/25. | ||
| 6 | +// Copyright © 2018年 梁星国. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#ifndef CNImagePickerCommonDefine_h | ||
| 10 | +#define CNImagePickerCommonDefine_h | ||
| 11 | + | ||
| 12 | + | ||
| 13 | +//////////////////////////////////////////////////////// | ||
| 14 | +//////////// Color | ||
| 15 | +//////////////////////////////////////////////////////// | ||
| 16 | + | ||
| 17 | +#define IP_RGBOF(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \ | ||
| 18 | +green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \ | ||
| 19 | +blue:((float)(rgbValue & 0xFF))/255.0 \ | ||
| 20 | +alpha:1.0] | ||
| 21 | + | ||
| 22 | +#define IP_RGBA_OF(rgbValue) [UIColor colorWithRed:((float)(((rgbValue) & 0xFF000000) >> 24))/255.0 \ | ||
| 23 | +green:((float)(((rgbValue) & 0x00FF0000) >> 16))/255.0 \ | ||
| 24 | +blue:((float)(rgbValue & 0x0000FF00) >> 8)/255.0 \ | ||
| 25 | +alpha:((float)(rgbValue & 0x000000FF))/255.0] | ||
| 26 | + | ||
| 27 | +#define IP_RGBAOF(v, a) [UIColor colorWithRed:((float)(((v) & 0xFF0000) >> 16))/255.0 \ | ||
| 28 | +green:((float)(((v) & 0x00FF00) >> 8))/255.0 \ | ||
| 29 | +blue:((float)(v & 0x0000FF))/255.0 \ | ||
| 30 | +alpha:a] | ||
| 31 | + | ||
| 32 | + | ||
| 33 | +//////////////////////////////////////////////////////// | ||
| 34 | +//////////// 发送图片,视频限制 | ||
| 35 | +//////////////////////////////////////////////////////// | ||
| 36 | +#define kFriendsCircle_limit_photo 20*1024.0*1024.0 //朋友圈限制图片20M | ||
| 37 | +#define kFirendsCircle_limit_video 30*1024.0*1024.0 //朋友圈限制视频30M | ||
| 38 | +#define kTarentoComment_limit_photo 10*1024.0*1024.0 //达人评论10M | ||
| 39 | +#define kSweepCode_limit_phoho 10*1024.0*1024.0 //扫码10M限制 | ||
| 40 | +#define kChat_limit_photo 20*1024.0*1024.0 //聊天限制图片20M | ||
| 41 | +#define kChat_limit_video 20*1024.0*1024.0 //聊天限制视频20M | ||
| 42 | + | ||
| 43 | +#define kChat_limit_video_length 5*60 //聊天限制视频5分钟 | ||
| 44 | +#define kFriendsCircle_limit_video_maxEdit 5*60 //朋友圈限制视频5分钟 | ||
| 45 | +#define kFriendsCircle_limit_video_max 10*60 //朋友圈限制最大视频编辑10分钟 | ||
| 46 | + | ||
| 47 | + | ||
| 48 | +#endif /* CNImagePickerCommonDefine_h */ |
CNLiveImagePickerController/utils/UIImage+CNImagePicker.h
0 → 100644
| 1 | +// | ||
| 2 | +// UIImage+CNImagePicker.h | ||
| 3 | +// CNLiveImagePickerControllerExample | ||
| 4 | +// | ||
| 5 | +// Created by 梁星国 on 2018/10/25. | ||
| 6 | +// Copyright © 2018年 梁星国. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import <UIKit/UIKit.h> | ||
| 10 | + | ||
| 11 | +NS_ASSUME_NONNULL_BEGIN | ||
| 12 | + | ||
| 13 | +@interface UIImage (CNImagePicker) | ||
| 14 | + | ||
| 15 | + | ||
| 16 | +/** | ||
| 17 | + 颜色t转图片 | ||
| 18 | + | ||
| 19 | + @param color 颜色 | ||
| 20 | + @return 返回f图片 | ||
| 21 | + */ | ||
| 22 | ++ (UIImage *)ip_imageWithColor:(UIColor *)color; | ||
| 23 | + | ||
| 24 | +/** | ||
| 25 | + 颜色转图片 | ||
| 26 | + | ||
| 27 | + @param color 颜色 | ||
| 28 | + @param size 大小 | ||
| 29 | + @param radius 圆角 | ||
| 30 | + @return 返回图片 | ||
| 31 | + */ | ||
| 32 | ++ (UIImage *)ip_imageWithColor:(UIColor *)color size:(CGSize)size radius:(CGFloat)radius; | ||
| 33 | + | ||
| 34 | + | ||
| 35 | + | ||
| 36 | +@end | ||
| 37 | + | ||
| 38 | +NS_ASSUME_NONNULL_END |
CNLiveImagePickerController/utils/UIImage+CNImagePicker.m
0 → 100644
| 1 | +// | ||
| 2 | +// UIImage+CNImagePicker.m | ||
| 3 | +// CNLiveImagePickerControllerExample | ||
| 4 | +// | ||
| 5 | +// Created by 梁星国 on 2018/10/25. | ||
| 6 | +// Copyright © 2018年 梁星国. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import "UIImage+CNImagePicker.h" | ||
| 10 | + | ||
| 11 | +@implementation UIImage (CNImagePicker) | ||
| 12 | + | ||
| 13 | ++ (UIImage *)ip_imageWithColor:(UIColor *)color { | ||
| 14 | + return [UIImage ip_imageWithColor:color size:CGSizeMake(4, 4) radius:0]; | ||
| 15 | +} | ||
| 16 | + | ||
| 17 | +/** | ||
| 18 | + 颜色转图片 | ||
| 19 | + | ||
| 20 | + @param color 颜色 | ||
| 21 | + @param size 大小 | ||
| 22 | + @param radius 圆角 | ||
| 23 | + @return 返回图片 | ||
| 24 | + */ | ||
| 25 | ++ (UIImage *)ip_imageWithColor:(UIColor *)color size:(CGSize)size radius:(CGFloat)radius { | ||
| 26 | + CGRect rect = CGRectMake(0.0f, 0.0f, size.width, size.height); | ||
| 27 | + UIGraphicsBeginImageContextWithOptions(rect.size, NO, [UIScreen mainScreen].scale); | ||
| 28 | + CGContextRef context = UIGraphicsGetCurrentContext(); | ||
| 29 | + CGContextSetFillColorWithColor(context, [color CGColor]); | ||
| 30 | + UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:rect cornerRadius:radius]; | ||
| 31 | + CGContextAddPath(context, path.CGPath); | ||
| 32 | + CGContextFillPath(context); | ||
| 33 | + UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); | ||
| 34 | + UIGraphicsEndImageContext(); | ||
| 35 | + return image; | ||
| 36 | +} | ||
| 37 | + | ||
| 38 | + | ||
| 39 | + | ||
| 40 | + | ||
| 41 | + | ||
| 42 | +@end |