iphone Programming Glossary: cgcontextsetfillcolorwithcolor
Drawing rotated text with NSString drawInRect http://stackoverflow.com/questions/10289898/drawing-rotated-text-with-nsstring-drawinrect CGContextDrawLinearGradient context gradient CGPointMake 0 centY halfWidth CGPointMake 0 centY halfWidth 0 Add text CGContextSetFillColorWithColor context UIColor whiteColor .CGColor NSString str @ some test string CGAffineTransform transform1 CGAffineTransformMakeRotation.. 2 rect.origin.y CGPointMake rect.origin.x rect.size.width 2 rect.origin.y rect.size.height 0 Create text CGContextSetFillColorWithColor context UIColor blackColor .CGColor NSString string @ some test string UIFont font UIFont systemFontOfSize 16.0 Rotate the..
iPhone - How do you color an image? http://stackoverflow.com/questions/1223340/iphone-how-do-you-color-an-image drawInRect rect CGContextRef context UIGraphicsGetCurrentContext CGContextSetBlendMode context kCGBlendModeSourceIn CGContextSetFillColorWithColor context color.CGColor CGContextFillRect context rect UIImage image UIGraphicsGetImageFromCurrentImageContext UIGraphicsEndImageContext..
Custom UISegmentedControl http://stackoverflow.com/questions/1281601/custom-uisegmentedcontrol CGRect rect CGRectMake 0 0 1 1 UIGraphicsBeginImageContext rect.size CGContextRef context UIGraphicsGetCurrentContext CGContextSetFillColorWithColor context UIColor clearColor CGColor CGContextFillRect context rect UIImage transparentImage UIGraphicsGetImageFromCurrentImageContext..
UIImage color changing? http://stackoverflow.com/questions/1698971/uiimage-color-changing CGContextRef context UIGraphicsGetCurrentContext image drawAtPoint CGPointZero blendMode kCGBlendModeNormal alpha 1.0 CGContextSetFillColorWithColor context color.CGColor CGContextSetBlendMode context kCGBlendModeOverlay CGContextSetAlpha context alpha CGContextFillRect..
Add text to CALayer http://stackoverflow.com/questions/2209734/add-text-to-calayer any specific UILabel functionality that you want to leverage void drawLayer CALayer layer inContext CGContextRef ctx CGContextSetFillColorWithColor ctx UIColor darkTextColor CGColor UIGraphicsPushContext ctx word drawInRect layer.bounds withFont UIFont systemFontOfSize..
How to change an UILabel/UIFont's letter spacing? http://stackoverflow.com/questions/2544905/how-to-change-an-uilabel-uifonts-letter-spacing NSASCIIStringEncoding self.font.pointSize kCGEncodingMacRoman CGContextSetCharacterSpacing context 1 CGContextSetFillColorWithColor context UIColor clearColor CGColor CGAffineTransform myTextTransform CGAffineTransformScale CGAffineTransformIdentity 1.f.. context calculate width and draw second one. float width v.x p.x float centeredX self.frame.size.width width 2 CGContextSetFillColorWithColor context self.textColor CGColor CGContextShowTextAtPoint context centeredX centeredY self.text cStringUsingEncoding NSASCIIStringEncoding..
UIImage rounded corners http://stackoverflow.com/questions/262156/uiimage-rounded-corners free the rgb colorspace CGColorSpaceRelease colorSpace if mainViewContentContext NULL return NULL CGContextSetFillColorWithColor mainViewContentContext UIColor whiteColor CGColor CGContextFillRect mainViewContentContext CGRectMake 0 0 targetSize.width..
How can i change the color of pagination dots of UIPageControl? http://stackoverflow.com/questions/2942636/how-can-i-change-the-color-of-pagination-dots-of-uipagecontrol 2 for int i 0 i _numberOfPages i CGRect circleRect CGRectMake x y kDotDiameter kDotDiameter if i _currentPage CGContextSetFillColorWithColor context self.dotColorCurrentPage.CGColor else CGContextSetFillColorWithColor context self.dotColorOtherPage.CGColor CGContextFillEllipseInRect.. kDotDiameter if i _currentPage CGContextSetFillColorWithColor context self.dotColorCurrentPage.CGColor else CGContextSetFillColorWithColor context self.dotColorOtherPage.CGColor CGContextFillEllipseInRect context circleRect x kDotDiameter kDotSpacer void dealloc..
iPhone - Draw transparent rectangle on UIView to reveal view beneath http://stackoverflow.com/questions/3800278/iphone-draw-transparent-rectangle-on-uiview-to-reveal-view-beneath like this void drawRect CGRect rect Get the current graphics context CGContextRef context UIGraphicsGetCurrentContext CGContextSetFillColorWithColor context UIColor blueColor .CGColor CGContextFillRect context rect if CGRectIntersects holeRect rect CGContextSetFillColorWithColor..
want to add manual erasing option in ipad painting application by quartz http://stackoverflow.com/questions/3863931/want-to-add-manual-erasing-option-in-ipad-painting-application-by-quartz lineWidth CGContextSetStrokeColorWithColor UIGraphicsGetCurrentContext UIColor colorWithPatternImage img .CGColor CGContextSetFillColorWithColor UIGraphicsGetCurrentContext UIColor clearColor .CGColor CGContextSetShouldAntialias UIGraphicsGetCurrentContext YES CGContextBeginPath..
How to customize the background/border colors of a grouped table view cell? http://stackoverflow.com/questions/400965/how-to-customize-the-background-border-colors-of-a-grouped-table-view-cell Initialization code return self void drawRect CGRect rect Drawing code CGContextRef c UIGraphicsGetCurrentContext CGContextSetFillColorWithColor c fillColor CGColor CGContextSetStrokeColorWithColor c borderColor CGColor if position CustomCellBackgroundViewPositionTop..
How to draw a “speech bubble” on an iPhone? http://stackoverflow.com/questions/4442126/how-to-draw-a-speech-bubble-on-an-iphone CGContextSetLineWidth context strokeWidth CGContextSetStrokeColorWithColor context MyPopupLayer popupBorderColor CGContextSetFillColorWithColor context MyPopupLayer popupBackgroundColor Draw and fill the bubble CGContextBeginPath context CGContextMoveToPoint context..
Get RGB value from UIColor presets http://stackoverflow.com/questions/4700168/get-rgb-value-from-uicolor-presets context CGBitmapContextCreate resultingPixel 1 1 8 4 rgbColorSpace kCGImageAlphaNoneSkipLast CGContextSetFillColorWithColor context color CGColor CGContextFillRect context CGRectMake 0 0 1 1 CGContextRelease context CGColorSpaceRelease rgbColorSpace..
Drawing waveform with AVAssetReader http://stackoverflow.com/questions/5032775/drawing-waveform-with-avassetreader sampleCount imageHeight UIGraphicsBeginImageContext imageSize CGContextRef context UIGraphicsGetCurrentContext CGContextSetFillColorWithColor context UIColor blackColor .CGColor CGContextSetAlpha context 1.0 CGRect rect rect.size imageSize rect.origin.x 0 rect.origin.y.. sampleCount imageHeight UIGraphicsBeginImageContext imageSize CGContextRef context UIGraphicsGetCurrentContext CGContextSetFillColorWithColor context UIColor blackColor .CGColor CGContextSetAlpha context 1.0 CGRect rect rect.size imageSize rect.origin.x 0 rect.origin.y..
Draw glow around inside edge of multiple CGPaths http://stackoverflow.com/questions/8480401/draw-glow-around-inside-edge-of-multiple-cgpaths isn't zero. CGContextTranslateCTM gc bounds.origin.x bounds.origin.y whiteColor has all components 1 including alpha. CGContextSetFillColorWithColor gc UIColor whiteColor .CGColor Fill each path into the mask. for UIBezierPath path in paths CGContextBeginPath gc CGContextAddPath..
|