From 130a79027bdd3d4cf7f600d4aac2a00d5054ecdb Mon Sep 17 00:00:00 2001 From: jianpx Date: Wed, 31 Jul 2013 14:02:05 +0800 Subject: [PATCH] should release colorspace. --- .../JXBarChartViewExample/JXBarChartView.m | 27 ++++---- .../PagedImageScrollView.podspec | 65 ------------------- 2 files changed, 16 insertions(+), 76 deletions(-) diff --git a/JXBarChartView/JXBarChartViewExample/JXBarChartView.m b/JXBarChartView/JXBarChartViewExample/JXBarChartView.m index 0beb927..4a02d1f 100644 --- a/JXBarChartView/JXBarChartViewExample/JXBarChartView.m +++ b/JXBarChartView/JXBarChartViewExample/JXBarChartView.m @@ -46,17 +46,22 @@ - (id)initWithFrame:(CGRect)frame _textColor = textColor ? textColor : [UIColor orangeColor]; _barHeight = barHeight; _barMaxWidth = barMaxWidth; - CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); - //blue gradient - CGFloat locations[] = {0.0, 0.5, 1.0}; - CGFloat colorComponents[] = { - 0.254, 0.599, 0.82, 1.0, //red, green, blue, alpha - 0.192, 0.525, 0.75, 1.0, - 0.096, 0.415, 0.686, 1.0 - }; - size_t count = 3; - CGGradientRef defaultGradient = CGGradientCreateWithColorComponents(colorSpace, colorComponents, locations, count); - _gradient = gradient ? gradient : defaultGradient; + if (gradient) { + _gradient = gradient; + } else { + CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); + //blue gradient + CGFloat locations[] = {0.0, 0.5, 1.0}; + CGFloat colorComponents[] = { + 0.254, 0.599, 0.82, 1.0, //red, green, blue, alpha + 0.192, 0.525, 0.75, 1.0, + 0.096, 0.415, 0.686, 1.0 + }; + size_t count = 3; + CGGradientRef defaultGradient = CGGradientCreateWithColorComponents(colorSpace, colorComponents, locations, count); + _gradient = defaultGradient; + CGColorSpaceRelease(colorSpace); + } self.backgroundColor = [UIColor whiteColor]; } return self; diff --git a/PagedImageScrollView/PagedImageScrollView.podspec b/PagedImageScrollView/PagedImageScrollView.podspec index 530c1d3..bc50337 100644 --- a/PagedImageScrollView/PagedImageScrollView.podspec +++ b/PagedImageScrollView/PagedImageScrollView.podspec @@ -1,77 +1,12 @@ -# -# Be sure to run `pod spec lint PagedImageScrollView.podspec' to ensure this is a -# valid spec and remove all comments before submitting the spec. -# -# To learn more about the attributes see http://docs.cocoapods.org/specification.html -# Pod::Spec.new do |s| s.name = "PagedImageScrollView" s.version = "0.0.1" s.summary = "It can easily generate imagescrollview with pagecontrol, swipe two fingers can switch the image." s.homepage = "https://github.com/jianpx/ios-cabin/tree/master/PagedImageScrollView" - # s.screenshots = "www.example.com/screenshots_1", "www.example.com/screenshots_2" - - # Specify the license type. CocoaPods detects automatically the license file if it is named - # 'LICENCE*.*' or 'LICENSE*.*', however if the name is different, specify it. s.license = 'MIT' - # s.license = { :type => 'MIT (example)', :file => 'FILE_LICENSE' } s.author = { "jianpx" => "jianpx86@gmail.com" } s.source = { :git => "https://github.com/jianpx/ios-cabin.git", :tag => "0.0.1" } - - - # If this Pod runs only on iOS or OS X, then specify the platform and - # the deployment target. - # s.platform = :ios, '5.0' - - # If this Pod runs on both platforms, then specify the deployment - # targets. - # - # s.ios.deployment_target = '5.0' - # s.osx.deployment_target = '10.7' - - # A list of file patterns which select the source files that should be - # added to the Pods project. If the pattern is a directory then the - # path will automatically have '*.{h,m,mm,c,cpp}' appended. - # s.source_files = 'PagedImageScrollView/*.{h,m}' - #s.exclude_files = 'Classes/Exclude' - - # A list of file patterns which select the header files that should be - # made available to the application. If the pattern is a directory then the - # path will automatically have '*.h' appended. - # - # If you do not explicitly set the list of public header files, - # all headers of source_files will be made public. - # - # s.public_header_files = 'Classes/**/*.h' - - # A list of resources included with the Pod. These are copied into the - # target bundle with a build phase script. - # - # s.resource = "icon.png" - # s.resources = "Resources/*.png" - - # A list of paths to preserve after installing the Pod. - # CocoaPods cleans by default any file that is not used. - # Please don't include documentation, example, and test files. - # - # s.preserve_paths = "FilesToSave", "MoreFilesToSave" - - # Specify a list of frameworks that the application needs to link - # against for this Pod to work. - # - # s.framework = 'SomeFramework' - # s.frameworks = 'SomeFramework', 'AnotherFramework' - - # Specify a list of libraries that the application needs to link - # against for this Pod to work. - # - # s.library = 'iconv' - # s.libraries = 'iconv', 'xml2' - - # If this Pod uses ARC, specify it like so. - # s.requires_arc = true - end