I have a custom UIButton class that adds a gradient and glitter effect to UIButton, the code works fine in iOS 4 and on the iOS5 simulator, but when I run it on iOS 5 devices, it gives me an EXC_BAD_ACCESS exception, the exception is triggered by the line:
CGContextStrokePath(context);
any help really appreciated here is my code
- (void)drawRect:(CGRect)rect { CGContextRef context = UIGraphicsGetCurrentContext(); CGFloat actualBrightness = _brightness; if (self.selected) { actualBrightness -= 0.10; } CGColorRef blackColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0].CGColor; CGColorRef highlightStart = [UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:0.7].CGColor; CGColorRef highlightStop = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.0].CGColor; CGColorRef outerTop = [UIColor colorWithHue:_hue saturation:_saturation brightness:1.0*actualBrightness alpha:1.0].CGColor; CGColorRef outerBottom = [UIColor colorWithHue:_hue saturation:_saturation brightness:0.80*actualBrightness alpha:1.0].CGColor; CGFloat outerMargin = 7.5f; CGRect outerRect = CGRectInset(self.bounds, outerMargin, outerMargin); CGMutablePathRef outerPath = createRoundedRectForRect(outerRect, 6.0);
what i really want now is it really connected with iOS 5, or am i doing something else wrong?
ahmad source share