QuickUIUtil.swift 53 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418
  1. //
  2. // QuickUIUtil.swift
  3. // CommonUtil
  4. //
  5. // Created by lijunjie on 15/11/14.
  6. // Copyright © 2015年 lijunjie. All rights reserved.
  7. //
  8. import Foundation
  9. public class QuickUIUtil {
  10. static let share = QuickUIUtil()
  11. private init () {}
  12. public func colorFromRed(red: CGFloat, green: CGFloat, blue: CGFloat) -> UIColor {
  13. return self.colorFromRed(red: red, green: green, blue: blue, alpha: 1.0)
  14. }
  15. public func colorFromRed(red: CGFloat, green: CGFloat, blue: CGFloat, alpha: CGFloat) -> UIColor {
  16. return UIColor(red: red/255.0, green: green/255.0, blue: blue/255.0, alpha: alpha)
  17. }
  18. public func colorFromHexString(hexString: String) -> UIColor {
  19. return self.colorFromHexString(hexString: hexString, alpha: 1.0)
  20. }
  21. public func colorFromHexString(hexString: String, alpha: CGFloat) -> UIColor {
  22. var hexNum: UInt32 = 0
  23. Scanner(string: hexString).scanHexInt32(&hexNum)
  24. return UIColor(red: ((CGFloat)((hexNum & 0xFF0000) >> 16))/255.0 , green: ((CGFloat)((hexNum & 0xFF00) >> 8))/255.0, blue: ((CGFloat)(hexNum & 0xFF))/255.0, alpha: alpha)
  25. }
  26. //
  27. // + (CGContextRef)getTextCTMContextRefFromView:(UIView *)aView
  28. // {
  29. // if (CUCFCheckObjectNull(aView)) {
  30. // return nil
  31. // }
  32. //
  33. // /* 获取图形上下文 */
  34. // CGContextRef context = UIGraphicsGetCurrentContext()
  35. //
  36. // /* 变换矩阵 */
  37. // CGContextTranslateCTM(context, 0, aView.bounds.size.height)
  38. // CGContextScaleCTM(context, 1, -1.0)
  39. //
  40. // /* 设置文字绘制矩阵 */
  41. // CGContextSetTextMatrix(context, CGAffineTransformIdentity)
  42. //
  43. // return context
  44. // }
  45. //
  46. // /* 根据颜色创建图片 */
  47. // + (UIImage *)imageForColor:(UIColor*)aColor withSize:(CGSize)aSize
  48. // {
  49. // if (CUCFCheckObjectNull(aColor)) {
  50. // return nil
  51. // }
  52. //
  53. // CGRect rect = CGRectMake(0, 0, aSize.width, aSize.height)
  54. //
  55. // UIGraphicsBeginImageContext(rect.size)
  56. //
  57. // CGContextRef context = UIGraphicsGetCurrentContext()
  58. //
  59. // CGContextSetFillColorWithColor(context, aColor.CGColor)
  60. //
  61. // CGContextFillRect(context, rect)
  62. //
  63. // UIImage *img = UIGraphicsGetImageFromCurrentImageContext()
  64. //
  65. // UIGraphicsEndImageContext()
  66. //
  67. // return img
  68. // }
  69. //
  70. // + (UIImage *)viewScreenShot:(UIView *)aView
  71. // {
  72. // return [CUCFQuickUIUitil layerScreenShot:aView.layer]
  73. // }
  74. //
  75. // + (UIImage *)layerScreenShot:(CALayer *)layer
  76. // {
  77. // if (CUCFCheckObjectNull(layer)) {
  78. // return nil
  79. // }
  80. //
  81. // UIGraphicsBeginImageContextWithOptions(layer.bounds.size, layer.opaque, 0.0f)
  82. // [layer renderInContext:UIGraphicsGetCurrentContext()]
  83. // UIImage* image = UIGraphicsGetImageFromCurrentImageContext()
  84. // UIGraphicsEndImageContext()
  85. // return image
  86. // }
  87. //
  88. // + (UIImage *)combineImage:(UIImage *)backgroundImage withMaskImage:(UIImage *)maskImage
  89. // {
  90. // if (CUCFCheckObjectNull(backgroundImage)) {
  91. // return nil
  92. // }
  93. // UIGraphicsBeginImageContext(backgroundImage.size)
  94. //
  95. // // 绘制改变大小的图片
  96. // CGRect newImageFrame = CGRectMake(0, 0,backgroundImage.size.width, backgroundImage.size.height)
  97. //
  98. // [backgroundImage drawInRect:newImageFrame]
  99. //
  100. // CGFloat originX = (newImageFrame.size.width - maskImage.size.width)/2
  101. // CGFloat originY = (newImageFrame.size.height - maskImage.size.height)/2
  102. //
  103. // CGRect maskImageFrame = CGRectMake(originX, originY, maskImage.size.width, maskImage.size.height)
  104. //
  105. // [maskImage drawInRect:maskImageFrame]
  106. //
  107. // UIImage* scaledImage = UIGraphicsGetImageFromCurrentImageContext()
  108. //
  109. // UIGraphicsEndImageContext()
  110. //
  111. // return scaledImage
  112. //
  113. // }
  114. //
  115. // + (UIImage *)fixOretationImage:(UIImage *)aImage
  116. // {
  117. // if (!aImage) {
  118. // return nil
  119. // }
  120. //
  121. // // 正确的方向
  122. // if (aImage.imageOrientation == UIImageOrientationUp){
  123. //
  124. // CGSize scaleSize = aImage.size
  125. //
  126. // UIGraphicsBeginImageContext(scaleSize)
  127. //
  128. // // 绘制改变大小的图片
  129. // [aImage drawInRect:CGRectMake(0, 0, scaleSize.width, scaleSize.height)]
  130. //
  131. // UIImage* scaledImage = UIGraphicsGetImageFromCurrentImageContext()
  132. //
  133. // UIGraphicsEndImageContext()
  134. //
  135. // return scaledImage
  136. // }
  137. //
  138. // // 错误的方向
  139. // CGAffineTransform transform = CGAffineTransformIdentity
  140. //
  141. // switch (aImage.imageOrientation) {
  142. // case UIImageOrientationDown:
  143. // case UIImageOrientationDownMirrored:
  144. // transform = CGAffineTransformTranslate(transform, aImage.size.width, aImage.size.height)
  145. // transform = CGAffineTransformRotate(transform, M_PI)
  146. // break
  147. //
  148. // case UIImageOrientationLeft:
  149. // case UIImageOrientationLeftMirrored:
  150. // transform = CGAffineTransformTranslate(transform, aImage.size.width, 0)
  151. // transform = CGAffineTransformRotate(transform, M_PI_2)
  152. // break
  153. //
  154. // case UIImageOrientationRight:
  155. // case UIImageOrientationRightMirrored:
  156. // transform = CGAffineTransformTranslate(transform, 0, aImage.size.height)
  157. // transform = CGAffineTransformRotate(transform, -M_PI_2)
  158. // break
  159. // case UIImageOrientationUp:
  160. // case UIImageOrientationUpMirrored:
  161. // break
  162. // }
  163. //
  164. // switch (aImage.imageOrientation) {
  165. // case UIImageOrientationUpMirrored:
  166. // case UIImageOrientationDownMirrored:
  167. // transform = CGAffineTransformTranslate(transform, aImage.size.width, 0)
  168. // transform = CGAffineTransformScale(transform, -1, 1)
  169. // break
  170. //
  171. // case UIImageOrientationLeftMirrored:
  172. // case UIImageOrientationRightMirrored:
  173. // transform = CGAffineTransformTranslate(transform, aImage.size.height, 0)
  174. // transform = CGAffineTransformScale(transform, -1, 1)
  175. // break
  176. // case UIImageOrientationUp:
  177. // case UIImageOrientationDown:
  178. // case UIImageOrientationLeft:
  179. // case UIImageOrientationRight:
  180. // break
  181. // }
  182. //
  183. // CGContextRef ctx = CGBitmapContextCreate(NULL, aImage.size.width, aImage.size.height,
  184. // CGImageGetBitsPerComponent(aImage.CGImage), 0,
  185. // CGImageGetColorSpace(aImage.CGImage),
  186. // CGImageGetBitmapInfo(aImage.CGImage))
  187. // CGContextConcatCTM(ctx, transform)
  188. // switch (aImage.imageOrientation) {
  189. // case UIImageOrientationLeft:
  190. // case UIImageOrientationLeftMirrored:
  191. // case UIImageOrientationRight:
  192. // case UIImageOrientationRightMirrored:
  193. //
  194. // CGContextDrawImage(ctx, CGRectMake(0,0,aImage.size.height,aImage.size.width), aImage.CGImage)
  195. // break
  196. //
  197. // default:
  198. // CGContextDrawImage(ctx, CGRectMake(0,0,aImage.size.width,aImage.size.height), aImage.CGImage)
  199. // break
  200. // }
  201. //
  202. // // 创建一张新图
  203. // CGImageRef cgimg = CGBitmapContextCreateImage(ctx)
  204. // UIImage *img = [UIImage imageWithCGImage:cgimg]
  205. // CGContextRelease(ctx)
  206. // CGImageRelease(cgimg)
  207. //
  208. // return img
  209. // }
  210. //
  211. // + (UIImage *)partImage:(UIImage *)aImage withRect:(CGRect)partRect
  212. // {
  213. // if (CUCFCheckObjectNull(aImage)) {
  214. // return nil
  215. // }
  216. //
  217. // CGImageRef imager = CGImageCreateWithImageInRect(aImage.CGImage,partRect)
  218. //
  219. // UIImage *partImage = [UIImage imageWithCGImage:imager]
  220. //
  221. // CGImageRelease(imager)
  222. //
  223. // return partImage
  224. //
  225. // }
  226. //
  227. // + (UIImage *)correctFullSolutionImageFromALAsset:(ALAsset *)asset withScaleSize:(CGFloat)scaleSize
  228. // {
  229. // if (CUCFCheckObjectNull(asset)) {
  230. // return nil
  231. // }
  232. //
  233. // ALAssetRepresentation *defaultReprensent = [asset defaultRepresentation]
  234. //
  235. // UIImage *fullSolutionImage = [UIImage imageWithCGImage:defaultReprensent.fullResolutionImage scale:1.0 orientation:(UIImageOrientation)[defaultReprensent orientation]]
  236. //
  237. // return [CUCFQuickUIUitil correctImageOrientation:fullSolutionImage withScaleSize:scaleSize]
  238. // }
  239. //
  240. // + (UIImage *)correctFullSolutionImageFromALAsset:(ALAsset *)asset
  241. // {
  242. // return [CUCFQuickUIUitil correctFullSolutionImageFromALAsset:asset withScaleSize:1.0]
  243. // }
  244. //
  245. // + (UIImage *)correctImageOrientation:(UIImage *)aImage
  246. // {
  247. // return [CUCFQuickUIUitil correctImageOrientation:aImage withScaleSize:1.0]
  248. // }
  249. //
  250. // + (UIImage *)correctImageOrientation:(UIImage *)aImage withScaleSize:(CGFloat)scale
  251. // {
  252. // if (CUCFCheckObjectNull(aImage)) {
  253. // return nil
  254. // }
  255. //
  256. // // 正确的方向
  257. // if (aImage.imageOrientation == UIImageOrientationUp){
  258. //
  259. // CGSize scaleSize = CGSizeMake(aImage.size.width * scale, aImage.size.height * scale)
  260. //
  261. // UIGraphicsBeginImageContext(scaleSize)
  262. //
  263. // // 绘制改变大小的图片
  264. // [aImage drawInRect:CGRectMake(0, 0, scaleSize.width, scaleSize.height)]
  265. //
  266. // UIImage* scaledImage = UIGraphicsGetImageFromCurrentImageContext()
  267. //
  268. // UIGraphicsEndImageContext()
  269. //
  270. // return scaledImage
  271. // }
  272. //
  273. // // 错误的方向
  274. // CGAffineTransform transform = CGAffineTransformIdentity
  275. //
  276. // switch (aImage.imageOrientation) {
  277. // case UIImageOrientationDown:
  278. // case UIImageOrientationDownMirrored:
  279. // transform = CGAffineTransformTranslate(transform, aImage.size.width, aImage.size.height)
  280. // transform = CGAffineTransformRotate(transform, M_PI)
  281. // break
  282. //
  283. // case UIImageOrientationLeft:
  284. // case UIImageOrientationLeftMirrored:
  285. // transform = CGAffineTransformTranslate(transform, aImage.size.width, 0)
  286. // transform = CGAffineTransformRotate(transform, M_PI_2)
  287. // break
  288. //
  289. // case UIImageOrientationRight:
  290. // case UIImageOrientationRightMirrored:
  291. // transform = CGAffineTransformTranslate(transform, 0, aImage.size.height)
  292. // transform = CGAffineTransformRotate(transform, -M_PI_2)
  293. // break
  294. // case UIImageOrientationUp:
  295. // case UIImageOrientationUpMirrored:
  296. // break
  297. // }
  298. //
  299. // switch (aImage.imageOrientation) {
  300. // case UIImageOrientationUpMirrored:
  301. // case UIImageOrientationDownMirrored:
  302. // transform = CGAffineTransformTranslate(transform, aImage.size.width, 0)
  303. // transform = CGAffineTransformScale(transform, -1, 1)
  304. // break
  305. //
  306. // case UIImageOrientationLeftMirrored:
  307. // case UIImageOrientationRightMirrored:
  308. // transform = CGAffineTransformTranslate(transform, aImage.size.height, 0)
  309. // transform = CGAffineTransformScale(transform, -1, 1)
  310. // break
  311. // case UIImageOrientationUp:
  312. // case UIImageOrientationDown:
  313. // case UIImageOrientationLeft:
  314. // case UIImageOrientationRight:
  315. // break
  316. // }
  317. //
  318. // CGContextRef ctx = CGBitmapContextCreate(NULL, aImage.size.width, aImage.size.height,
  319. // CGImageGetBitsPerComponent(aImage.CGImage), 0,
  320. // CGImageGetColorSpace(aImage.CGImage),
  321. // CGImageGetBitmapInfo(aImage.CGImage))
  322. // CGContextConcatCTM(ctx, transform)
  323. // switch (aImage.imageOrientation) {
  324. // case UIImageOrientationLeft:
  325. // case UIImageOrientationLeftMirrored:
  326. // case UIImageOrientationRight:
  327. // case UIImageOrientationRightMirrored:
  328. //
  329. // CGContextDrawImage(ctx, CGRectMake(0,0,aImage.size.height,aImage.size.width), aImage.CGImage)
  330. // break
  331. //
  332. // default:
  333. // CGContextDrawImage(ctx, CGRectMake(0,0,aImage.size.width,aImage.size.height), aImage.CGImage)
  334. // break
  335. // }
  336. //
  337. // // 创建一张新图
  338. // CGImageRef cgimg = CGBitmapContextCreateImage(ctx)
  339. // UIImage *img = [UIImage imageWithCGImage:cgimg]
  340. // CGContextRelease(ctx)
  341. // CGImageRelease(cgimg)
  342. //
  343. // CGSize scaleSize = CGSizeMake(aImage.size.width * scale, aImage.size.height * scale)
  344. //
  345. // UIGraphicsBeginImageContext(scaleSize)
  346. //
  347. // // 绘制改变大小的图片
  348. // [img drawInRect:CGRectMake(0, 0, scaleSize.width, scaleSize.height)]
  349. //
  350. // UIImage* scaledImage = UIGraphicsGetImageFromCurrentImageContext()
  351. //
  352. // UIGraphicsEndImageContext()
  353. //
  354. // return scaledImage
  355. //
  356. // }
  357. //
  358. // + (UIImage *)roundImage:(UIImage *)aImage
  359. // {
  360. // if (CUCFCheckObjectNull(aImage)) {
  361. // return nil
  362. // }
  363. //
  364. // /* 取最小边,否则会出现椭圆 */
  365. // CGFloat itemWidth = MIN(aImage.size.width, aImage.size.height)
  366. //
  367. // //取中心
  368. // CGFloat originX = (aImage.size.width - itemWidth)/2
  369. // CGFloat originY = (aImage.size.height - itemWidth)/2
  370. // CGRect imageRect = (CGRect){originX,originY,itemWidth,itemWidth}
  371. // aImage = [CUCFQuickUIUitil partImage:aImage withRect:imageRect]
  372. // imageRect.origin = CGPointZero;//恢复
  373. //
  374. // UIGraphicsBeginImageContextWithOptions((CGSize){itemWidth,itemWidth}, 1.0, 0.0f)
  375. //
  376. // CGColorSpaceRef maskColorSpaceRef = CGColorSpaceCreateDeviceGray()
  377. // CGContextRef mainMaskContextRef = CGBitmapContextCreate(NULL,
  378. // imageRect.size.width,
  379. // imageRect.size.height,
  380. // 8,
  381. // imageRect.size.width,
  382. // maskColorSpaceRef,
  383. // 0)
  384. // CGContextFillRect(mainMaskContextRef, imageRect)
  385. // CGContextSetFillColorWithColor(mainMaskContextRef,[UIColor whiteColor].CGColor)
  386. //
  387. // // Create main mask shape
  388. // CGContextMoveToPoint(mainMaskContextRef, 0, 0)
  389. // CGContextAddEllipseInRect(mainMaskContextRef, imageRect)
  390. // CGContextFillPath(mainMaskContextRef)
  391. //
  392. // CGImageRef mainMaskImageRef = CGBitmapContextCreateImage(mainMaskContextRef)
  393. // CGContextRelease(mainMaskContextRef)
  394. //
  395. // CGContextRef contextRef = UIGraphicsGetCurrentContext()
  396. // CGContextSaveGState(contextRef)
  397. //
  398. // CGImageRef imageRef = CGImageCreateWithMask(aImage.CGImage, mainMaskImageRef)
  399. //
  400. // CGContextTranslateCTM(contextRef, 0, imageRect.size.height)
  401. // CGContextScaleCTM(contextRef, 1.0, -1.0)
  402. //
  403. // CGContextSaveGState(contextRef)
  404. //
  405. //
  406. // UIImage* image = [UIImage imageWithCGImage:imageRef]
  407. //
  408. // CGImageRelease(imageRef)
  409. // CGImageRelease(mainMaskImageRef)
  410. //
  411. // UIGraphicsEndImageContext()
  412. //
  413. // return image
  414. // }
  415. //
  416. // + (UIImage *)imageWithName:(NSString *)imageName
  417. // {
  418. // if (CUCFStringIsNull(imageName)) {
  419. // return nil
  420. // }
  421. // return [UIImage imageNamed:imageName]
  422. // }
  423. //
  424. // + (UIImage *)imageWithFilePath:(NSString *)filePath
  425. // {
  426. // if (CUCFStringIsNull(filePath)) {
  427. // return nil
  428. // }
  429. // return [UIImage imageWithContentsOfFile:filePath]
  430. // }
  431. //
  432. // + (UIImage *)imageUnArchievedFromFilePath:(NSString *)filePath
  433. // {
  434. // return CUCFUnArchieveObject(filePath)
  435. // }
  436. //
  437. // + (UIImage *)gradientLinearImageFromColor:(UIColor *)fromColor withToColor:(UIColor *)toColor withImageSize:(CGSize)size
  438. // {
  439. // return [CUCFQuickUIUitil gradientLinearImageFromColors:@[fromColor,toColor,fromColor] withImageSize:size]
  440. // }
  441. //
  442. // + (UIImage *)gradientLinearImageFromColors:(NSArray *)colors withImageSize:(CGSize)size
  443. // {
  444. // if (CUCFCheckObjectNull(colors)) {
  445. // return nil
  446. // }
  447. //
  448. // UIGraphicsBeginImageContext(size)
  449. //
  450. // CGContextRef context = UIGraphicsGetCurrentContext()
  451. //
  452. // CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB()
  453. //
  454. // CGFloat _locations[] = {0.f,0.5f,1.f}
  455. //
  456. // NSMutableArray *_colors = [NSMutableArray array]
  457. //
  458. // id fromColor = nil
  459. // if (colors.count >= 1) {
  460. // fromColor = (__bridge id)[(UIColor *)[colors objectAtIndex:0] CGColor]
  461. // }
  462. //
  463. // id toColor = nil
  464. // if (colors.count >= 2) {
  465. // toColor = (__bridge id)[(UIColor *)[colors objectAtIndex:1] CGColor]
  466. // }
  467. //
  468. // id endColor = nil
  469. // if (colors.count == 3) {
  470. // endColor = (__bridge id)[(UIColor *)[colors objectAtIndex:2] CGColor]
  471. // }
  472. //
  473. // if (fromColor) {
  474. // [_colors addObject:fromColor]
  475. // }
  476. // if (toColor) {
  477. // [_colors addObject:toColor]
  478. // }
  479. // if (endColor) {
  480. // [_colors addObject:endColor]
  481. // }
  482. //
  483. // CGGradientRef gradient = CGGradientCreateWithColors(colorSpace, (__bridge CFArrayRef)_colors, _locations)
  484. //
  485. // CGPoint startPoint = CGPointMake(floorf(size.width), 0)
  486. //
  487. // CGPoint endPoint = CGPointMake(floorf(size.width), size.height)
  488. //
  489. // CGContextDrawLinearGradient(context, gradient, startPoint, endPoint, 0)
  490. //
  491. // CFRelease(gradient)
  492. //
  493. // CFRelease(colorSpace)
  494. //
  495. // UIImage *gradientImage = UIGraphicsGetImageFromCurrentImageContext()
  496. //
  497. // UIGraphicsEndImageContext()
  498. //
  499. // return gradientImage
  500. //
  501. // }
  502. //
  503. // + (UIImage *)gradientRadialImageFromColor:(UIColor *)fromColor withToColor:(UIColor *)toColor withImageSize:(CGSize)size
  504. // {
  505. // return [CUCFQuickUIUitil gradientRadialImageFromColors:@[fromColor,toColor] withImageSize:size]
  506. // }
  507. //
  508. // + (UIImage *)gradientRadialImageFromColors:(NSArray *)colors withImageSize:(CGSize)size
  509. // {
  510. // if (CUCFCheckObjectNull(colors)) {
  511. // return nil
  512. // }
  513. //
  514. // UIGraphicsBeginImageContext(size)
  515. //
  516. // CGContextRef context = UIGraphicsGetCurrentContext()
  517. //
  518. // CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB()
  519. //
  520. // CGFloat _locations[] = {0.f,0.5,1.f}
  521. //
  522. // NSMutableArray *_colors = [NSMutableArray array]
  523. //
  524. // id fromColor = nil
  525. // if (colors.count >= 1) {
  526. // fromColor = (__bridge id)[(UIColor *)[colors objectAtIndex:0] CGColor]
  527. // }
  528. //
  529. // id toColor = nil
  530. // if (colors.count >= 2) {
  531. // toColor = (__bridge id)[(UIColor *)[colors objectAtIndex:1] CGColor]
  532. // }
  533. //
  534. // id endColor = nil
  535. // if (colors.count == 3) {
  536. // endColor = (__bridge id)[(UIColor *)[colors objectAtIndex:2] CGColor]
  537. // }
  538. //
  539. // if (fromColor) {
  540. // [_colors addObject:fromColor]
  541. // }
  542. // if (toColor) {
  543. // [_colors addObject:toColor]
  544. // }
  545. // if (endColor) {
  546. // [_colors addObject:endColor]
  547. // }
  548. //
  549. // CGGradientRef gradient = CGGradientCreateWithColors(colorSpace, (__bridge CFArrayRef)_colors, _locations)
  550. //
  551. // CGPoint startPoint = CGPointMake(floorf(size.width/2), size.height/2)
  552. //
  553. // CGFloat radius = MIN(size.width/2, size.height/2)
  554. // CGContextDrawRadialGradient(context, gradient, startPoint, 0, startPoint,radius, kCGGradientDrawsBeforeStartLocation|kCGGradientDrawsAfterEndLocation)
  555. //
  556. // CFRelease(gradient)
  557. //
  558. // CFRelease(colorSpace)
  559. //
  560. // UIImage *gradientImage = UIGraphicsGetImageFromCurrentImageContext()
  561. //
  562. // UIGraphicsEndImageContext()
  563. //
  564. // return gradientImage
  565. // }
  566. //
  567. // + (UIImage *)gridImageHorizonByLineGap:(CGFloat)lineGap withLineColor:(UIColor *)lineColor withImageSize:(CGSize)size
  568. // {
  569. // return [CUCFQuickUIUitil gridImageByHoriLineGap:lineGap withVerticalLineGap:0.f withLineColor:lineColor withImageSize:size]
  570. // }
  571. //
  572. // + (UIImage *)gridImageVerticalByLineGap:(CGFloat)lineGap withLineColor:(UIColor *)lineColor withImageSize:(CGSize)size
  573. // {
  574. // return [CUCFQuickUIUitil gridImageByHoriLineGap:0.f withVerticalLineGap:lineGap withLineColor:lineColor withImageSize:size]
  575. // }
  576. //
  577. // + (UIImage *)gridImageByHoriLineGap:(CGFloat)hLineGap withVerticalLineGap:(CGFloat)vLineGap withLineColor:(UIColor *)lineColor withImageSize:(CGSize)size
  578. // {
  579. // CGFloat width = size.width
  580. // CGFloat height = size.height
  581. //
  582. // UIGraphicsBeginImageContext(CGSizeMake(width, height))
  583. // CGContextRef context = UIGraphicsGetCurrentContext()
  584. //
  585. // CGContextSetStrokeColorWithColor(context, lineColor.CGColor)
  586. //
  587. // if (hLineGap > 0.f) {
  588. //
  589. // for (int y=0; y < height; y=y+hLineGap) {
  590. //
  591. // CGContextBeginPath(context)
  592. //
  593. // CGContextMoveToPoint(context, 0, y)
  594. //
  595. // CGContextAddLineToPoint(context, width, y)
  596. //
  597. // CGContextStrokePath(context)
  598. // }
  599. // }
  600. //
  601. // if (vLineGap > 0.f) {
  602. //
  603. // for (int x=0; x<width; x=x+vLineGap) {
  604. //
  605. // CGContextBeginPath(context)
  606. //
  607. // CGContextMoveToPoint(context, x, 0)
  608. //
  609. // CGContextAddLineToPoint(context, x, height)
  610. //
  611. // CGContextStrokePath(context)
  612. // }
  613. // }
  614. //
  615. //
  616. // UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext()
  617. // UIGraphicsEndImageContext()
  618. //
  619. // return newImage
  620. //
  621. // }
  622. //
  623. // + (UIImage *)stretchImage:(UIImage *)originImage withTopOffset:(CGFloat)top withLeftOffset:(CGFloat)left
  624. // {
  625. // if (CUCFCheckObjectNull(originImage)) {
  626. // return nil
  627. // }
  628. // return [originImage stretchableImageWithLeftCapWidth:left topCapHeight:top]
  629. // }
  630. //
  631. // + (UIImage *)resizeImage:(UIImage *)originImage withEdgeTop:(CGFloat)top withEdgeBottom:(CGFloat)bottom withEdgeLeft:(CGFloat)left withEdgeRight:(CGFloat)right
  632. // {
  633. // if (CUCFCheckObjectNull(originImage)) {
  634. // return nil
  635. // }
  636. // return [originImage resizableImageWithCapInsets:UIEdgeInsetsMake(top, left, bottom, right) resizingMode:UIImageResizingModeStretch]
  637. // }
  638. //
  639. // + (void)animationDuration:(NSTimeInterval)duration action:(dispatch_block_t)block
  640. // {
  641. // [CUCFQuickUIUitil animationDelay:0 animationDuration:duration action:block]
  642. // }
  643. //
  644. // + (void)animationDelay:(NSTimeInterval )delaySecond animationDuration:(NSTimeInterval)duration action:(dispatch_block_t)block
  645. // {
  646. // if (CUCFCheckObjectNull(block)) {
  647. // return
  648. // }
  649. //
  650. // CUCFAsyncMainQueueDelay(delaySecond, ^{
  651. //
  652. // [UIView animateWithDuration:duration animations:block]
  653. //
  654. // })
  655. // }
  656. //
  657. // + (void)animationView:(UIView *)view withDuration:(NSTimeInterval)duration action:(dispatch_block_t)block withOptions:(UIViewAnimationOptions)options completionBlock:(CUCFQuickAnimationCompletionBlock)completion
  658. // {
  659. // [CUCFQuickUIUitil animationView:view delay:0 animationDuration:duration action:block withOptions:options completionBlock:completion]
  660. // }
  661. //
  662. // + (void)animationView:(UIView *)view delay:(NSTimeInterval)delaySecond animationDuration:(NSTimeInterval)duration action:(dispatch_block_t)block withOptions:(UIViewAnimationOptions)options completionBlock:(CUCFQuickAnimationCompletionBlock)completion
  663. // {
  664. // if (CUCFCheckObjectNull(view)) {
  665. // return
  666. // }
  667. // [UIView transitionWithView:view duration:duration options:options animations:block completion:completion]
  668. // }
  669. //
  670. // + (void)defaultHiddenShowView:(UIView *)view
  671. // {
  672. // [CUCFQuickUIUitil hiddenShowView:view withDuration:0.3]
  673. // }
  674. //
  675. // + (void)defaultShowHiddenView:(UIView *)view
  676. // {
  677. // [CUCFQuickUIUitil showHiddenView:view withDuration:0.3]
  678. // }
  679. //
  680. // + (void)defaultHiddenView:(UIView *)view
  681. // {
  682. // [CUCFQuickUIUitil hiddenView:view withDuration:0.3]
  683. // }
  684. //
  685. // + (void)defaultShowView:(UIView *)view
  686. // {
  687. // [CUCFQuickUIUitil showView:view withDuration:0.3]
  688. // }
  689. //
  690. // + (void)hiddenView:(UIView *)view withDuration:(NSTimeInterval)duration
  691. // {
  692. // [CUCFQuickUIUitil animationView:view fromAlpha:view.alpha toAlpha:0 withDuration:duration]
  693. // }
  694. //
  695. // + (void)showView:(UIView *)view withDuration:(NSTimeInterval)duration
  696. // {
  697. // [CUCFQuickUIUitil animationView:view fromAlpha:view.alpha toAlpha:1 withDuration:duration]
  698. // }
  699. //
  700. // + (void)showView:(UIView *)view finalAlpha:(CGFloat)alpha withDuration:(NSTimeInterval)duration
  701. // {
  702. // [CUCFQuickUIUitil animationView:view fromAlpha:view.alpha toAlpha:alpha withDuration:duration]
  703. // }
  704. //
  705. // + (void)hiddenShowView:(UIView *)view withDuration:(NSTimeInterval)duration
  706. // {
  707. // [CUCFQuickUIUitil animationView:view fromAlpha:0 toAlpha:1 withDuration:duration]
  708. // }
  709. //
  710. // + (void)showHiddenView:(UIView *)view withDuration:(NSTimeInterval)duration
  711. // {
  712. // [CUCFQuickUIUitil animationView:view fromAlpha:1 toAlpha:0 withDuration:duration]
  713. // }
  714. //
  715. // + (void)animationView:(UIView *)view fromAlpha:(CGFloat)fAlpha toAlpha:(CGFloat)tAlpha withDuration:(NSTimeInterval)duration
  716. // {
  717. // if (CUCFCheckObjectNull(view)) {
  718. // return
  719. // }
  720. //
  721. // view.alpha = fAlpha
  722. //
  723. // CUCFAnimationWithDuration(duration, ^{
  724. //
  725. // view.alpha = tAlpha
  726. //
  727. // })
  728. // }
  729. //
  730. // + (void)moveView:(UIView *)view newRect:(CGRect)rect withDuration:(NSTimeInterval)duration
  731. // {
  732. // if (CUCFCheckObjectNull(view)) {
  733. // return
  734. // }
  735. //
  736. // if (CGRectEqualToRect(view.frame, rect)) {
  737. // return
  738. // }
  739. //
  740. // CUCFAnimationWithDuration(duration, ^{
  741. //
  742. // view.frame = rect
  743. //
  744. // })
  745. // }
  746. //
  747. // + (void)moveViewX:(UIView *)view originXDetal:(CGFloat)moveX withDuration:(NSTimeInterval)duration
  748. // {
  749. // [CUCFQuickUIUitil moveView:view originXDetal:moveX originYDetal:0.f widthDetal:0.f heightDetla:0.f withDuration:duration]
  750. // }
  751. //
  752. // + (void)moveViewY:(UIView *)view originYDetal:(CGFloat)moveY withDuration:(NSTimeInterval)duration
  753. // {
  754. // [CUCFQuickUIUitil moveView:view originXDetal:0.f originYDetal:moveY widthDetal:0.f heightDetla:0.f withDuration:duration]
  755. // }
  756. //
  757. // + (void)moveViewWidth:(UIView *)view widthDetal:(CGFloat)moveWidth withDuration:(NSTimeInterval)duration
  758. // {
  759. // [CUCFQuickUIUitil moveView:view originXDetal:0.f originYDetal:0.f widthDetal:moveWidth heightDetla:0.f withDuration:duration]
  760. // }
  761. //
  762. // + (void)moveViewHeight:(UIView *)view heightDetal:(CGFloat)moveHeight withDuration:(NSTimeInterval)duration
  763. // {
  764. // [CUCFQuickUIUitil moveView:view originXDetal:0.f originYDetal:0.f widthDetal:0.f heightDetla:moveHeight withDuration:duration]
  765. // }
  766. //
  767. // + (void)moveViewToX:(UIView *)view toOriginX:(CGFloat)moveX withDuration:(NSTimeInterval)duration
  768. // {
  769. // CGFloat detal = moveX - view.frame.origin.x
  770. // [CUCFQuickUIUitil moveViewX:view originXDetal:detal withDuration:duration]
  771. // }
  772. //
  773. // + (void)moveViewToY:(UIView *)view toOriginY:(CGFloat)moveY withDuration:(NSTimeInterval)duration
  774. // {
  775. // CGFloat detal = moveY - view.frame.origin.y
  776. // [CUCFQuickUIUitil moveViewY:view originYDetal:detal withDuration:duration]
  777. // }
  778. //
  779. // + (void)moveViewToWidth:(UIView *)view toWidth:(CGFloat)moveWidth withDuration:(NSTimeInterval)duration
  780. // {
  781. // CGFloat detal = moveWidth - view.frame.size.width
  782. // [CUCFQuickUIUitil moveViewWidth:view widthDetal:detal withDuration:duration]
  783. // }
  784. //
  785. // + (void)moveViewToHeight:(UIView *)view toHeight:(CGFloat)moveHeight withDuration:(NSTimeInterval)duration
  786. // {
  787. // CGFloat detal = moveHeight - view.frame.size.height
  788. // [CUCFQuickUIUitil moveViewHeight:view heightDetal:detal withDuration:duration]
  789. // }
  790. //
  791. // + (void)moveViewCenter:(UIView *)view newCenter:(CGPoint)center withDuration:(NSTimeInterval)duration
  792. // {
  793. // CUCFAnimationWithDuration(duration, ^{
  794. //
  795. // view.center = center
  796. //
  797. // })
  798. // }
  799. //
  800. // + (void)moveViewSize:(UIView *)view newSize:(CGSize)size withDuration:(NSTimeInterval)duration
  801. // {
  802. // CGRect newFrame = view.frame
  803. // newFrame.size = size
  804. // CUCFAnimationMoveViewRect(view, newFrame, duration)
  805. // }
  806. //
  807. // + (void)moveView:(UIView *)view originXDetal:(CGFloat)moveX originYDetal:(CGFloat)moveY widthDetal:(CGFloat)moveWidth heightDetla:(CGFloat)moveHeight withDuration:(NSTimeInterval)duration
  808. // {
  809. // CGRect newFrame = view.frame
  810. // newFrame.origin.x = newFrame.origin.x + moveX
  811. // newFrame.origin.y = newFrame.origin.y + moveY
  812. // newFrame.size.width = newFrame.size.width + moveWidth
  813. // newFrame.size.height = newFrame.size.height + moveHeight
  814. //
  815. // [CUCFQuickUIUitil moveView:view newRect:newFrame withDuration:duration]
  816. // }
  817. //
  818. // + (void)flipViewFromLeft:(UIView *)view withDuration:(NSTimeInterval)duration action:(dispatch_block_t)block completionBlock:(CUCFQuickAnimationCompletionBlock)completion
  819. // {
  820. // [CUCFQuickUIUitil flipView:view fromLeft:YES fromRight:NO fromTop:NO fromBottom:NO action:block withDuration:duration completionBlock:completion]
  821. // }
  822. //
  823. // + (void)flipViewFromRight:(UIView *)view withDuration:(NSTimeInterval)duration action:(dispatch_block_t)block completionBlock:(CUCFQuickAnimationCompletionBlock)completion
  824. // {
  825. // [CUCFQuickUIUitil flipView:view fromLeft:NO fromRight:YES fromTop:NO fromBottom:NO action:block withDuration:duration completionBlock:completion]
  826. // }
  827. //
  828. // + (void)flipViewFromTop:(UIView *)view withDuration:(NSTimeInterval)duration action:(dispatch_block_t)block completionBlock:(CUCFQuickAnimationCompletionBlock)completion
  829. // {
  830. // [CUCFQuickUIUitil flipView:view fromLeft:NO fromRight:NO fromTop:YES fromBottom:NO action:block withDuration:duration completionBlock:completion]
  831. // }
  832. //
  833. // + (void)flipViewFromBottom:(UIView *)view withDuration:(NSTimeInterval)duration action:(dispatch_block_t)block completionBlock:(CUCFQuickAnimationCompletionBlock)completion
  834. // {
  835. // [CUCFQuickUIUitil flipView:view fromLeft:NO fromRight:NO fromTop:NO fromBottom:YES action:block withDuration:duration completionBlock:completion]
  836. // }
  837. //
  838. // + (void)flipView:(UIView *)view fromLeft:(BOOL)isLeft fromRight:(BOOL)isRight fromTop:(BOOL)isTop fromBottom:(BOOL)isBottom action:(dispatch_block_t)block withDuration:(NSTimeInterval)duration completionBlock:(CUCFQuickAnimationCompletionBlock)completion
  839. // {
  840. // if (CUCFCheckObjectNull(view)) {
  841. // return
  842. // }
  843. // if (isLeft) {
  844. // [CUCFQuickUIUitil animationView:view withDuration:duration action:block withOptions:UIViewAnimationOptionTransitionFlipFromLeft completionBlock:completion]
  845. // }
  846. // if (isRight) {
  847. // [CUCFQuickUIUitil animationView:view withDuration:duration action:block withOptions:UIViewAnimationOptionTransitionFlipFromRight completionBlock:completion]
  848. // }
  849. // if (isTop) {
  850. // [CUCFQuickUIUitil animationView:view withDuration:duration action:block withOptions:UIViewAnimationOptionTransitionFlipFromTop completionBlock:completion]
  851. // }
  852. // if (isBottom) {
  853. // [CUCFQuickUIUitil animationView:view withDuration:duration action:block withOptions:UIViewAnimationOptionTransitionFlipFromBottom completionBlock:completion]
  854. // }
  855. // }
  856. //
  857. // + (void)pageUpViewFromBottom:(UIView *)view withDuration:(NSTimeInterval)duration action:(dispatch_block_t)block completionBlock:(CUCFQuickAnimationCompletionBlock)completion
  858. // {
  859. // [CUCFQuickUIUitil pageUpView:view fromLeft:NO fromRight:NO fromTop:NO fromBottom:YES action:block withDuration:duration completionBlock:completion]
  860. // }
  861. //
  862. // + (void)pageUpView:(UIView *)view fromLeft:(BOOL)isLeft fromRight:(BOOL)isRight fromTop:(BOOL)isTop fromBottom:(BOOL)isBottom action:(dispatch_block_t)block withDuration:(NSTimeInterval)duration completionBlock:(CUCFQuickAnimationCompletionBlock)completion
  863. // {
  864. // if (CUCFCheckObjectNull(view)) {
  865. // return
  866. // }
  867. // if (isBottom) {
  868. // [CUCFQuickUIUitil animationView:view withDuration:duration action:block withOptions:UIViewAnimationOptionTransitionCurlUp|UIViewAnimationOptionCurveEaseInOut completionBlock:completion]
  869. // }
  870. // }
  871. //
  872. // + (void)pageDownViewFromTop:(UIView *)view withDuration:(NSTimeInterval)duration action:(dispatch_block_t)block completionBlock:(CUCFQuickAnimationCompletionBlock)completion
  873. // {
  874. // [CUCFQuickUIUitil pageDownView:view fromLeft:NO fromRight:NO fromTop:YES fromBottom:NO action:block withDuration:duration completionBlock:completion]
  875. // }
  876. //
  877. // + (void)pageDownView:(UIView *)view fromLeft:(BOOL)isLeft fromRight:(BOOL)isRight fromTop:(BOOL)isTop fromBottom:(BOOL)isBottom action:(dispatch_block_t)block withDuration:(NSTimeInterval)duration completionBlock:(CUCFQuickAnimationCompletionBlock)completion
  878. // {
  879. // if (CUCFCheckObjectNull(view)) {
  880. // return
  881. // }
  882. // if (isTop) {
  883. // [CUCFQuickUIUitil animationView:view withDuration:duration action:block withOptions:UIViewAnimationOptionTransitionCurlDown|UIViewAnimationOptionCurveEaseInOut completionBlock:completion]
  884. // }
  885. // }
  886. //
  887. // + (void)cubeView:(UIView *)view withDuration:(NSTimeInterval)duration action:(dispatch_block_t)block completionBlock:(CUCFQuickAnimationCompletionBlock)completion
  888. // {
  889. // if (CUCFCheckObjectNull(view)) {
  890. // return
  891. // }
  892. // [CUCFQuickUIUitil animationView:view withDuration:duration action:block withOptions:UIViewAnimationOptionTransitionCrossDissolve|UIViewAnimationOptionCurveEaseInOut completionBlock:completion]
  893. // }
  894. //
  895. //
  896. // + (void)rotationViewX:(UIView *)view withDegree:(CGFloat)degree withDuration:(NSTimeInterval)duration
  897. // {
  898. // NSString *path = @"transform.rotation.x"
  899. // [CUCFQuickUIUitil animationView:view withAnimationPath:path toValue:CUCFDegreeToRadiusValue(degree) withDuration:duration]
  900. // }
  901. //
  902. // + (void)rotationViewY:(UIView *)view withDegree:(CGFloat)degree withDuration:(NSTimeInterval)duration
  903. // {
  904. // NSString *path = @"transform.rotation.y"
  905. // [CUCFQuickUIUitil animationView:view withAnimationPath:path toValue:CUCFDegreeToRadiusValue(degree) withDuration:duration]
  906. // }
  907. //
  908. // + (void)rotationViewZ:(UIView *)view withDegree:(CGFloat)degree withDuration:(NSTimeInterval)duration
  909. // {
  910. // NSString *path = @"transform.rotation.z"
  911. // [CUCFQuickUIUitil animationView:view withAnimationPath:path toValue:CUCFDegreeToRadiusValue(degree) withDuration:duration]
  912. // }
  913. //
  914. // + (void)translationViewX:(UIView *)view withOriginX:(CGFloat)originX withDuration:(NSTimeInterval)duration
  915. // {
  916. // NSString *path = @"transform.translation.x"
  917. // [CUCFQuickUIUitil animationView:view withAnimationPath:path toValue:@(originX) withDuration:duration]
  918. // }
  919. //
  920. // + (void)translationViewY:(UIView *)view withOriginY:(CGFloat)originY withDuration:(NSTimeInterval)duration
  921. // {
  922. // NSString *path = @"transform.translation.y"
  923. // [CUCFQuickUIUitil animationView:view withAnimationPath:path toValue:@(originY) withDuration:duration]
  924. // }
  925. //
  926. // + (void)translationViewZ:(UIView *)view withOriginZ:(CGFloat)originZ withDuration:(NSTimeInterval)duration
  927. // {
  928. // NSString *path = @"transform.translation.z"
  929. // [CUCFQuickUIUitil animationView:view withAnimationPath:path toValue:@(originZ) withDuration:duration]
  930. // }
  931. //
  932. // + (void)scaleViewX:(UIView *)view withScaleSize:(CGFloat)size withDuration:(NSTimeInterval)duration
  933. // {
  934. // NSString *path = @"transform.scale.x"
  935. // [CUCFQuickUIUitil animationView:view withAnimationPath:path toValue:@(size) withDuration:duration]
  936. // }
  937. //
  938. // + (void)scaleViewY:(UIView *)view withScaleSize:(CGFloat)size withDuration:(NSTimeInterval)duration
  939. // {
  940. // NSString *path = @"transform.scale.y"
  941. // [CUCFQuickUIUitil animationView:view withAnimationPath:path toValue:@(size) withDuration:duration]
  942. // }
  943. //
  944. // + (void)scaleViewZ:(UIView *)view withScaleSize:(CGFloat)size withDuration:(NSTimeInterval)duration
  945. // {
  946. // NSString *path = @"transform.scale.z"
  947. // [CUCFQuickUIUitil animationView:view withAnimationPath:path toValue:@(size) withDuration:duration]
  948. // }
  949. //
  950. // + (void)animationView:(UIView *)view withAnimationPath:(NSString *)path toValue:(NSValue *)value withDuration:(NSTimeInterval)duration
  951. // {
  952. // if (CUCFCheckObjectNull(view)) {
  953. // return
  954. // }
  955. // CABasicAnimation* basicAnimation = [CABasicAnimation animationWithKeyPath:path]
  956. // basicAnimation.toValue = value
  957. // basicAnimation.duration = duration
  958. // basicAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]
  959. // [view.layer addAnimation:basicAnimation forKey:[NSString stringWithFormat:@"cucfAnimation_%@_%lu_%lu_%f",path,(unsigned long)[view hash],(unsigned long)[value hash],duration]]
  960. // }
  961. //
  962. // + (void)view3DRotateX:(UIView *)view withDegree:(CGFloat)degree
  963. // {
  964. // [CUCFQuickUIUitil view3DRotate:view x:1 y:0 z:0 withDegree:CUCFDegreeToRadius(degree)]
  965. // }
  966. //
  967. // + (void)view3DRotateY:(UIView *)view withDegree:(CGFloat)degree
  968. // {
  969. // [CUCFQuickUIUitil view3DRotate:view x:0 y:1 z:0 withDegree:CUCFDegreeToRadius(degree)]
  970. // }
  971. //
  972. // + (void)view3DRotateZ:(UIView *)view withDegree:(CGFloat)degree
  973. // {
  974. // [CUCFQuickUIUitil view3DRotate:view x:0 y:0 z:1 withDegree:CUCFDegreeToRadius(degree)]
  975. // }
  976. //
  977. // + (void)view3DRotate:(UIView *)view x:(CGFloat)xState y:(CGFloat)yState z:(CGFloat)zState withDegree:(CGFloat)degree
  978. // {
  979. // if (CUCFCheckObjectNull(view)) {
  980. // return
  981. // }
  982. // CUCFAnimationWithDuration(0.35, ^{
  983. // view.layer.transform = CATransform3DMakeRotation(degree, xState, yState, zState)
  984. // })
  985. // }
  986. //
  987. // + (void)view3DTranslateX:(UIView *)view withValue:(CGFloat)value
  988. // {
  989. // [CUCFQuickUIUitil view3DTranslate:view x:value y:0 z:0]
  990. // }
  991. //
  992. // + (void)view3DTranslateY:(UIView *)view withValue:(CGFloat)value
  993. // {
  994. // [CUCFQuickUIUitil view3DTranslate:view x:0 y:value z:0]
  995. // }
  996. //
  997. // + (void)view3DTranslateZ:(UIView *)view withValue:(CGFloat)value
  998. // {
  999. // [CUCFQuickUIUitil view3DTranslate:view x:0 y:0 z:value]
  1000. // }
  1001. //
  1002. // + (void)view3DTranslate:(UIView *)view x:(CGFloat)xState y:(CGFloat)yState z:(CGFloat)zState
  1003. // {
  1004. // if (CUCFCheckObjectNull(view)) {
  1005. // return
  1006. // }
  1007. // CUCFAnimationWithDuration(0.35, ^{
  1008. // view.layer.transform = CATransform3DMakeTranslation(xState, yState, zState)
  1009. // })
  1010. // }
  1011. //
  1012. // + (void)view3DScaleX:(UIView *)view withValue:(CGFloat)value
  1013. // {
  1014. // [CUCFQuickUIUitil view3DScale:view x:value y:0 z:0]
  1015. // }
  1016. //
  1017. // + (void)view3DScaleY:(UIView *)view withValue:(CGFloat)value
  1018. // {
  1019. // [CUCFQuickUIUitil view3DScale:view x:0 y:value z:0]
  1020. // }
  1021. //
  1022. // + (void)view3DScaleZ:(UIView *)view withValue:(CGFloat)value
  1023. // {
  1024. // [CUCFQuickUIUitil view3DScale:view x:0 y:0 z:value]
  1025. // }
  1026. //
  1027. // + (void)view3DScale:(UIView *)view x:(CGFloat)xState y:(CGFloat)yState z:(CGFloat)zState
  1028. // {
  1029. // if (CUCFCheckObjectNull(view)) {
  1030. // return
  1031. // }
  1032. // CUCFAnimationWithDuration(0.35, ^{
  1033. // view.layer.transform = CATransform3DMakeScale(xState, yState, zState)
  1034. // })
  1035. // }
  1036. //
  1037. // + (CUCFQuickUIUitil *)shareQuickUIUitil
  1038. // {
  1039. // static CUCFQuickUIUitil *_shareQuickUIInstance = nil
  1040. // static dispatch_once_t onceToken
  1041. // CUCFDispatchOnce(onceToken, ^{
  1042. //
  1043. // if (!_shareQuickUIInstance) {
  1044. // _shareQuickUIInstance = [[self alloc]init]
  1045. // }
  1046. // })
  1047. // return _shareQuickUIInstance
  1048. // }
  1049. //
  1050. // - (void)addRepeatBlockInfo:(NSDictionary *)blockActionInfoDict
  1051. // {
  1052. // [self.repeatActionInfoDict setObject:blockActionInfoDict forKey:[blockActionInfoDict objectForKey:@"uniqueIdentifier"]]
  1053. // }
  1054. //
  1055. // - (void)repeatAction:(NSTimer *)timer
  1056. // {
  1057. // if (self.repeatActionInfoDict.count == 0) {
  1058. // [self.repeatTimer invalidate]
  1059. // self.repeatTimer = nil
  1060. // return
  1061. // }
  1062. // [self.repeatActionInfoDict enumerateKeysAndObjectsUsingBlock:^(NSString *blockIdentifier, NSDictionary *blockInfoDict, BOOL *stop) {
  1063. //
  1064. // dispatch_block_t action = [blockInfoDict objectForKey:@"action"]
  1065. //
  1066. // NSTimeInterval duration = [[blockInfoDict objectForKey:@"repeatDuration"]doubleValue]
  1067. //
  1068. // NSTimeInterval progress = [[blockInfoDict objectForKey:@"progress"]doubleValue]
  1069. //
  1070. // if (progress <= duration) {
  1071. //
  1072. // CUCFAsyncMainQueue(action)
  1073. //
  1074. // progress = progress + timer.timeInterval
  1075. //
  1076. // [blockInfoDict setValue:@(progress) forKey:@"progress"]
  1077. //
  1078. // [self.repeatActionInfoDict setObject:blockInfoDict forKey:blockIdentifier]
  1079. //
  1080. // }else{
  1081. //
  1082. // [self removeBlockInfo:blockIdentifier]
  1083. // }
  1084. //
  1085. // }]
  1086. //
  1087. // }
  1088. //
  1089. // - (void)removeBlockInfo:(NSString *)blockIdentifier
  1090. // {
  1091. // if (CUCFStringIsNull(blockIdentifier)) {
  1092. // return
  1093. // }
  1094. // if (self.repeatActionInfoDict.count == 0) {
  1095. // return
  1096. // }
  1097. // __block NSString *findDestBlockIdentifier = nil
  1098. // [self.repeatActionInfoDict enumerateKeysAndObjectsUsingBlock:^(NSString *blockIdentifier, NSDictionary *blockInfoDict, BOOL *stop) {
  1099. //
  1100. // NSString *blockInfoIdentifier = [blockInfoDict objectForKey:@"uniqueIdentifier"]
  1101. // if ([blockInfoIdentifier isEqualToString:blockIdentifier]) {
  1102. // findDestBlockIdentifier = blockInfoIdentifier
  1103. // *stop = YES
  1104. // }
  1105. // }]
  1106. // [self.repeatActionInfoDict removeObjectForKey:findDestBlockIdentifier]
  1107. // }
  1108. //
  1109. // - (void)startRepeatAction
  1110. // {
  1111. // if (self.repeatActionInfoDict.count > 0) {
  1112. // if (self.repeatTimer) {
  1113. // [self.repeatTimer invalidate]
  1114. // self.repeatTimer = nil
  1115. // }
  1116. // self.repeatTimer = [NSTimer scheduledTimerWithTimeInterval:0.3 target:self selector:@selector(repeatAction:) userInfo:nil repeats:YES]
  1117. // }else{
  1118. // if (self.repeatTimer) {
  1119. // [self.repeatTimer invalidate]
  1120. // self.repeatTimer = nil
  1121. // }
  1122. // }
  1123. // }
  1124. //
  1125. // + (NSString *)repeatDoAction:(dispatch_block_t)block
  1126. // {
  1127. // return [CUCFQuickUIUitil repeatDoAction:block withDelay:0.f]
  1128. // }
  1129. //
  1130. // + (NSString *)repeatDoAction:(dispatch_block_t)block withDelay:(NSTimeInterval)delaySecond
  1131. // {
  1132. // return [CUCFQuickUIUitil repeatDoAction:block withDelay:delaySecond withRepeatDuration:0]
  1133. // }
  1134. //
  1135. // + (NSString *)repeatDoAction:(dispatch_block_t)block withRepeatDuration:(NSTimeInterval)duration
  1136. // {
  1137. // return [CUCFQuickUIUitil repeatDoAction:block withDelay:0 withRepeatDuration:duration]
  1138. // }
  1139. //
  1140. // + (NSString *)repeatDoAction:(dispatch_block_t)block withDelay:(NSTimeInterval)delaySecond withRepeatDuration:(NSTimeInterval)duration
  1141. // {
  1142. // if (CUCFCheckObjectNull(block)) {
  1143. // return nil
  1144. // }
  1145. //
  1146. // NSString *blockIdentifier = CUCFStringCurrentTimeStamp
  1147. //
  1148. // CUCFAsyncMainQueueDelay(delaySecond, ^{
  1149. //
  1150. // NSMutableDictionary *blockActionInfo = [NSMutableDictionary dictionary]
  1151. // [blockActionInfo setObject:block forKey:@"action"]
  1152. // [blockActionInfo setObject:blockIdentifier forKey:@"uniqueIdentifier"]
  1153. // [blockActionInfo setObject:@(0) forKey:@"progress"]
  1154. // [blockActionInfo setObject:@(duration) forKey:@"repeatDuration"]
  1155. //
  1156. // [[CUCFQuickUIUitil shareQuickUIUitil]addRepeatBlockInfo:blockActionInfo]
  1157. // [[CUCFQuickUIUitil shareQuickUIUitil]startRepeatAction]
  1158. //
  1159. // })
  1160. //
  1161. // return blockIdentifier
  1162. // }
  1163. //
  1164. // + (void)stopRepeatAction:(NSString *)blockIdentifier
  1165. // {
  1166. // if (CUCFStringIsNull(blockIdentifier)) {
  1167. // return
  1168. // }
  1169. // [[CUCFQuickUIUitil shareQuickUIUitil]removeBlockInfo:blockIdentifier]
  1170. // }
  1171. //
  1172. // + (void)animationViewXCycle:(UIView *)view withXMoveDetal:(CGFloat)moveX withDuration:(NSTimeInterval)duration
  1173. // {
  1174. // CUCFAnimationViewTranslationX(view, moveX, duration)
  1175. // CUCFAnimationViewTranslationX(view, 0, duration)
  1176. // CUCFAnimationViewTranslationX(view, -moveX, duration)
  1177. // CUCFAnimationViewTranslationX(view, 0, duration)
  1178. // }
  1179. //
  1180. // + (void)animationViewYCycle:(UIView *)view withYMoveDetal:(CGFloat)moveY withDuration:(NSTimeInterval)duration
  1181. // {
  1182. // CUCFAnimationViewTranslationY(view, moveY, duration)
  1183. // CUCFAnimationViewTranslationY(view, 0, duration)
  1184. // CUCFAnimationViewTranslationY(view, -moveY, duration)
  1185. // CUCFAnimationViewTranslationY(view, 0, duration)
  1186. // }
  1187. //
  1188. // + (void)animationViewZCycle:(UIView *)view withZMoveDetal:(CGFloat)moveZ withDuration:(NSTimeInterval)duration
  1189. // {
  1190. // CUCFAnimationViewTranslationZ(view, moveZ, duration)
  1191. // CUCFAnimationViewTranslationZ(view, 0, duration)
  1192. // CUCFAnimationViewTranslationZ(view, -moveZ, duration)
  1193. // CUCFAnimationViewTranslationZ(view, 0, duration)
  1194. // }
  1195. //
  1196. // + (void)animationViewRotateXCycle:(UIView *)view withXRotateDetal:(CGFloat)xDegree withDuration:(NSTimeInterval)duration
  1197. // {
  1198. // CUCFAnimationViewRotateX(view, xDegree, duration)
  1199. // CUCFAnimationViewRotateX(view, 0, duration)
  1200. // CUCFAnimationViewRotateX(view, -xDegree, duration)
  1201. // CUCFAnimationViewRotateX(view, 0, duration)
  1202. // }
  1203. //
  1204. // + (void)animationViewRotateYCycle:(UIView *)view withYRotateDetal:(CGFloat)yDegree withDuration:(NSTimeInterval)duration
  1205. // {
  1206. // CUCFAnimationViewRotateY(view, yDegree, duration)
  1207. // CUCFAnimationViewRotateY(view, 0, duration)
  1208. // CUCFAnimationViewRotateY(view, -yDegree, duration)
  1209. // CUCFAnimationViewRotateY(view, 0, duration)
  1210. // }
  1211. //
  1212. // + (void)animationViewRotateZCycle:(UIView *)view withZRotateDetal:(CGFloat)zDegree withDuration:(NSTimeInterval)duration
  1213. // {
  1214. // CUCFAnimationViewRotateZ(view, zDegree, duration)
  1215. // CUCFAnimationViewRotateZ(view, 0, duration)
  1216. // CUCFAnimationViewRotateZ(view, -zDegree, duration)
  1217. // CUCFAnimationViewRotateZ(view, 0, duration)
  1218. // }
  1219. //
  1220. // /* CAAnimation */
  1221. //
  1222. // + (void)animationLayer:(CALayer *)aLayer positionXWithFromValue:(NSValue *)fromValue withToValue:(NSValue *)toValue withRepeatCount:(NSInteger)repeatCount withDuration:(NSTimeInterval)duration
  1223. // {
  1224. // return [CUCFQuickUIUitil animationLayer:aLayer path:@"position.x" withFromValue:fromValue withToValue:toValue withRepeatCount:repeatCount withDuration:duration]
  1225. // }
  1226. //
  1227. // + (void)animationLayer:(CALayer *)aLayer positionYWithFromValue:(NSValue *)fromValue withToValue:(NSValue *)toValue withRepeatCount:(NSInteger)repeatCount withDuration:(NSTimeInterval)duration
  1228. // {
  1229. // return [CUCFQuickUIUitil animationLayer:aLayer path:@"position.y" withFromValue:fromValue withToValue:toValue withRepeatCount:repeatCount withDuration:duration]
  1230. // }
  1231. //
  1232. // + (void)animationLayer:(CALayer *)aLayer positionCenterWithFromValue:(NSValue *)fromValue withToValue:(NSValue *)toValue withRepeatCount:(NSInteger)repeatCount withDuration:(NSTimeInterval)duration
  1233. // {
  1234. // return [CUCFQuickUIUitil animationLayer:aLayer path:@"position" withFromValue:fromValue withToValue:toValue withRepeatCount:repeatCount withDuration:duration]
  1235. // }
  1236. //
  1237. // + (void)animationLayer:(CALayer *)aLayer path:(NSString *)path withFromValue:(NSValue *)fromValue withToValue:(NSValue *)toValue withRepeatCount:(NSInteger)repeatCount withDuration:(NSTimeInterval)duration
  1238. // {
  1239. // if (CUCFCheckObjectNull(aLayer) || CUCFStringIsNull(path) || CUCFCheckKeyValueHasNull(fromValue, toValue)) {
  1240. // return
  1241. // }
  1242. //
  1243. // CABasicAnimation *basicAnimation = [CABasicAnimation animationWithKeyPath:path]
  1244. // basicAnimation.fromValue = fromValue
  1245. // basicAnimation.toValue = toValue
  1246. // basicAnimation.duration = duration
  1247. // basicAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]
  1248. // basicAnimation.beginTime = 0
  1249. // basicAnimation.autoreverses = YES
  1250. // basicAnimation.repeatCount = repeatCount
  1251. //
  1252. // [aLayer addAnimation:basicAnimation forKey:[NSString stringWithFormat:@"cucf_animation_%@",path]]
  1253. // }
  1254. //
  1255. // + (void)animationLayer:(CALayer *)aLayer positionXByValue:(NSValue *)value withRepeatCount:(NSInteger)repeatCount withDuration:(NSTimeInterval)duration
  1256. // {
  1257. // return [CUCFQuickUIUitil animationLayer:aLayer path:@"position.x" ByValue:value withRepeatCount:repeatCount withDuration:duration]
  1258. // }
  1259. //
  1260. // + (void)animationLayer:(CALayer *)aLayer positionYByValue:(NSValue *)value withRepeatCount:(NSInteger)repeatCount withDuration:(NSTimeInterval)duration
  1261. // {
  1262. // return [CUCFQuickUIUitil animationLayer:aLayer path:@"position.y" ByValue:value withRepeatCount:repeatCount withDuration:duration]
  1263. // }
  1264. //
  1265. // + (void)animationLayer:(CALayer *)aLayer positionCenterByValue:(NSValue *)value withRepeatCount:(NSInteger)repeatCount withDuration:(NSTimeInterval)duration
  1266. // {
  1267. // return [CUCFQuickUIUitil animationLayer:aLayer path:@"position" ByValue:value withRepeatCount:repeatCount withDuration:duration]
  1268. // }
  1269. //
  1270. // + (void)animationLayer:(CALayer *)aLayer path:(NSString *)path ByValue:(NSValue *)value withRepeatCount:(NSInteger)repeatCount withDuration:(NSTimeInterval)duration
  1271. // {
  1272. // if (CUCFCheckObjectNull(aLayer) || CUCFStringIsNull(path) || CUCFCheckObjectNull(value)) {
  1273. // return
  1274. // }
  1275. //
  1276. // CABasicAnimation *basicAnimation = [CABasicAnimation animationWithKeyPath:path]
  1277. // basicAnimation.byValue = value
  1278. // basicAnimation.duration = duration
  1279. // basicAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]
  1280. // basicAnimation.beginTime = 0
  1281. // basicAnimation.autoreverses = YES
  1282. // basicAnimation.repeatCount = repeatCount
  1283. //
  1284. // [aLayer addAnimation:basicAnimation forKey:[NSString stringWithFormat:@"cucf_animation_by_%@",path]]
  1285. //
  1286. // }
  1287. //
  1288. // #pragma mark - 获取圆角图片
  1289. //
  1290. // // Returns true if the image has an alpha layer
  1291. // + (BOOL)hasAlpha:(UIImage *)aImage {
  1292. // CGImageAlphaInfo alpha = CGImageGetAlphaInfo(aImage.CGImage)
  1293. // return (alpha == kCGImageAlphaFirst ||
  1294. // alpha == kCGImageAlphaLast ||
  1295. // alpha == kCGImageAlphaPremultipliedFirst ||
  1296. // alpha == kCGImageAlphaPremultipliedLast)
  1297. // }
  1298. //
  1299. // // Returns a copy of the given image, adding an alpha channel if it doesn't already have one
  1300. // + (UIImage *)imageWithAlpha:(UIImage *)aImage {
  1301. // if ([CUCFQuickUIUitil hasAlpha:aImage]) {
  1302. // return aImage
  1303. // }
  1304. //
  1305. // CGFloat scale = MAX(aImage.scale, 1.0f)
  1306. // CGImageRef imageRef = aImage.CGImage
  1307. // size_t width = CGImageGetWidth(imageRef)*scale
  1308. // size_t height = CGImageGetHeight(imageRef)*scale
  1309. //
  1310. // // The bitsPerComponent and bitmapInfo values are hard-coded to prevent an "unsupported parameter combination" error
  1311. // CGContextRef offscreenContext = CGBitmapContextCreate(NULL,
  1312. // width,
  1313. // height,
  1314. // 8,
  1315. // 0,
  1316. // CGImageGetColorSpace(imageRef),
  1317. // kCGBitmapByteOrderDefault | kCGImageAlphaPremultipliedFirst)
  1318. //
  1319. // // Draw the image into the context and retrieve the new image, which will now have an alpha layer
  1320. // CGContextDrawImage(offscreenContext, CGRectMake(0, 0, width, height), imageRef)
  1321. // CGImageRef imageRefWithAlpha = CGBitmapContextCreateImage(offscreenContext)
  1322. // UIImage *imageWithAlpha = [UIImage imageWithCGImage:imageRefWithAlpha scale:aImage.scale orientation:UIImageOrientationUp]
  1323. //
  1324. // // Clean up
  1325. // CGContextRelease(offscreenContext)
  1326. // CGImageRelease(imageRefWithAlpha)
  1327. //
  1328. // return imageWithAlpha
  1329. // }
  1330. //
  1331. // // Creates a copy of this image with rounded corners
  1332. // // If borderSize is non-zero, a transparent border of the given size will also be added
  1333. // // Original author: Björn Sållarp. Used with permission. See: http://blog.sallarp.com/iphone-uiimage-round-corners/
  1334. // + (UIImage *)roundedCornerImage:(UIImage *)aImage cornerSize:(NSInteger)cornerSize borderSize:(NSInteger)borderSize {
  1335. // // If the image does not have an alpha layer, add one
  1336. // UIImage *image = [CUCFQuickUIUitil imageWithAlpha:aImage]
  1337. //
  1338. // CGFloat scale = MAX(aImage.scale,1.0f)
  1339. // NSUInteger scaledBorderSize = borderSize * scale
  1340. //
  1341. // // Build a context that's the same dimensions as the new size
  1342. // CGContextRef context = CGBitmapContextCreate(NULL,
  1343. // image.size.width*scale,
  1344. // image.size.height*scale,
  1345. // CGImageGetBitsPerComponent(image.CGImage),
  1346. // 0,
  1347. // CGImageGetColorSpace(image.CGImage),
  1348. // CGImageGetBitmapInfo(image.CGImage))
  1349. //
  1350. // // Create a clipping path with rounded corners
  1351. //
  1352. // CGContextBeginPath(context)
  1353. // [CUCFQuickUIUitil addRoundedRectToPath:CGRectMake(scaledBorderSize, scaledBorderSize, image.size.width*scale - borderSize * 2, image.size.height*scale - borderSize * 2)
  1354. // context:context
  1355. // ovalWidth:cornerSize*scale
  1356. // ovalHeight:cornerSize*scale]
  1357. // CGContextClosePath(context)
  1358. // CGContextClip(context)
  1359. //
  1360. // // Draw the image to the context; the clipping path will make anything outside the rounded rect transparent
  1361. // CGContextDrawImage(context, CGRectMake(0, 0, image.size.width*scale, image.size.height*scale), image.CGImage)
  1362. //
  1363. // // Create a CGImage from the context
  1364. // CGImageRef clippedImage = CGBitmapContextCreateImage(context)
  1365. // CGContextRelease(context)
  1366. //
  1367. // // Create a UIImage from the CGImage
  1368. // UIImage *roundedImage = [UIImage imageWithCGImage:clippedImage scale:aImage.scale orientation:UIImageOrientationUp]
  1369. //
  1370. // CGImageRelease(clippedImage)
  1371. //
  1372. // return roundedImage
  1373. // }
  1374. //
  1375. // #pragma mark -
  1376. // #pragma mark Private helper methods
  1377. //
  1378. // // Adds a rectangular path to the given context and rounds its corners by the given extents
  1379. // // Original author: Björn Sållarp. Used with permission. See: http://blog.sallarp.com/iphone-uiimage-round-corners/
  1380. // + (void)addRoundedRectToPath:(CGRect)rect context:(CGContextRef)context ovalWidth:(CGFloat)ovalWidth ovalHeight:(CGFloat)ovalHeight {
  1381. // if (ovalWidth == 0 || ovalHeight == 0) {
  1382. // CGContextAddRect(context, rect)
  1383. // return
  1384. // }
  1385. // CGContextSaveGState(context)
  1386. // CGContextTranslateCTM(context, CGRectGetMinX(rect), CGRectGetMinY(rect))
  1387. // CGContextScaleCTM(context, ovalWidth, ovalHeight)
  1388. // CGFloat fw = CGRectGetWidth(rect) / ovalWidth
  1389. // CGFloat fh = CGRectGetHeight(rect) / ovalHeight
  1390. // CGContextMoveToPoint(context, fw, fh/2)
  1391. // CGContextAddArcToPoint(context, fw, fh, fw/2, fh, 1)
  1392. // CGContextAddArcToPoint(context, 0, fh, 0, fh/2, 1)
  1393. // CGContextAddArcToPoint(context, 0, 0, fw/2, 0, 1)
  1394. // CGContextAddArcToPoint(context, fw, 0, fw, fh/2, 1)
  1395. // CGContextClosePath(context)
  1396. // CGContextRestoreGState(context)
  1397. // }
  1398. //
  1399. // + (UIImage *)createRoundCornerImage:(UIImage *)aImage withCornerSize:(NSInteger)cornerSize withBoardSize:(NSInteger)boardSize
  1400. // {
  1401. // if (!aImage) {
  1402. // return nil
  1403. // }
  1404. // return [CUCFQuickUIUitil roundedCornerImage:aImage cornerSize:cornerSize borderSize:boardSize]
  1405. // }
  1406. }
  1407. public let SharedQuickUIUtil: QuickUIUtil = QuickUIUtil.share