¡@

Home 

2014/10/15 ¤U¤È 10:13:47

iphone Programming Glossary: self.bounds.size.width

Placeholder in UITextView

http://stackoverflow.com/questions/1328638/placeholder-in-uitextview

if self placeholder length 0 if _placeHolderLabel nil _placeHolderLabel UILabel alloc initWithFrame CGRectMake 8 8 self.bounds.size.width 16 0 _placeHolderLabel.lineBreakMode NSLineBreakByWordWrapping _placeHolderLabel.numberOfLines 0 _placeHolderLabel.font..

underline text in UIlabel

http://stackoverflow.com/questions/2711297/underline-text-in-uilabel

RGBA CGContextSetLineWidth ctx 1.0f CGContextMoveToPoint ctx 0 self.bounds.size.height 1 CGContextAddLineToPoint ctx self.bounds.size.width self.bounds.size.height 1 CGContextStrokePath ctx super drawRect rect UPD As of iOS 6 Apple added NSAttributedString support..

Inner Shadow in UILabel

http://stackoverflow.com/questions/3231690/inner-shadow-in-uilabel

UIGraphicsGetCurrentContext rect UIColor whiteColor setFill custom shape goes here text_ drawAtPoint CGPointMake self.bounds.size.width 2 fontSize.width 2 0 withFont font text_ drawAtPoint CGPointMake self.bounds.size.width 2 fontSize.width 2 1 withFont font.. text_ drawAtPoint CGPointMake self.bounds.size.width 2 fontSize.width 2 0 withFont font text_ drawAtPoint CGPointMake self.bounds.size.width 2 fontSize.width 2 1 withFont font CGImageRef cutoutRef CGImageCreateWithMask self blackSquareOfSize rect.size .CGImage.. rect.size NO 0 UIColor blackColor setFill custom shape goes here text_ drawAtPoint CGPointMake self.bounds.size.width 2 fontSize.width 2 1 withFont font UIImage negative UIGraphicsGetImageFromCurrentImageContext UIGraphicsEndImageContext..

subclassed UITableViewCell - backgroundView covers up anything I do in drawRect

http://stackoverflow.com/questions/3527925/subclassed-uitableviewcell-backgroundview-covers-up-anything-i-do-in-drawrect

@ cellBackground.png autorelease return self void drawRect CGRect rect self.starImage drawAtPoint CGPointMake self.bounds.size.width self.starImage.size.width 0.0 EDIT 2 at AWrightIV's request here's how I got it working... which didn't require subclassing..

Fast and Lean PDF Viewer for iPhone / iPad / iOs - tips and hints?

http://stackoverflow.com/questions/3889634/fast-and-lean-pdf-viewer-for-iphone-ipad-ios-tips-and-hints

CGContextGetCTM context if currentCTM.a 1.0 baseImage Calculate ideal scale CGFloat scaleForWidth baseImage.size.width self.bounds.size.width CGFloat scaleForHeight baseImage.size.height self.bounds.size.height CGFloat imageScaleFactor MAX scaleForWidth scaleForHeight.. CGSizeMake baseImage.size.width imageScaleFactor baseImage.size.height imageScaleFactor CGRect imageRect CGRectMake self.bounds.size.width imageSize.width 2 self.bounds.size.height imageSize.height 2 imageSize.width imageSize.height CGContextDrawImage context..

UITextView ruled line background but wrong line height

http://stackoverflow.com/questions/5375350/uitextview-ruled-line-background-but-wrong-line-height

context self.bounds.origin.x self.font.leading x 0.5f baselineOffset CGContextAddLineToPoint context self.bounds.size.width self.font.leading x 0.5f baselineOffset Close our Path and Stroke draw it CGContextClosePath context CGContextStrokePath..

Why is UIBezierPath faster than Core Graphics path?

http://stackoverflow.com/questions/6327817/why-is-uibezierpath-faster-than-core-graphics-path

200 curve segments to each path. int iterations 200 CGFloat cgBaseline 100 CGFloat uiBaseline 200 CGFloat xincrement self.bounds.size.width iterations for CGFloat x1 0 x2 xincrement x2 self.bounds.size.width x1 x2 x2 xincrement CGPathAddCurveToPoint cgpath NULL.. 100 CGFloat uiBaseline 200 CGFloat xincrement self.bounds.size.width iterations for CGFloat x1 0 x2 xincrement x2 self.bounds.size.width x1 x2 x2 xincrement CGPathAddCurveToPoint cgpath NULL x1 cgBaseline 50 x2 cgBaseline 50 x2 cgBaseline uipath addCurveToPoint.. 200 curve segments to each path. int iterations 80000 CGFloat cgBaseline 100 CGFloat uiBaseline 200 CGFloat xincrement self.bounds.size.width iterations for CGFloat x1 0 x2 xincrement x2 self.bounds.size.width x1 x2 x2 xincrement CGPathAddCurveToPoint cgpath NULL..

Is there an SDK to draw lines on iOS with touch?

http://stackoverflow.com/questions/6774352/is-there-an-sdk-to-draw-lines-on-ios-with-touch

self currentPoint.y 20 UIGraphicsBeginImageContext self.bounds.size drawImage.image drawInRect CGRectMake 0 0 self.bounds.size.width self.bounds.size.height CGContextSetLineCap UIGraphicsGetCurrentContext kCGLineCapRound CGContextSetLineWidth UIGraphicsGetCurrentContext.. nil return if mouseSwiped UIGraphicsBeginImageContext self.bounds.size drawImage.image drawInRect CGRectMake 0 0 self.bounds.size.width self.bounds.size.height CGContextSetLineCap UIGraphicsGetCurrentContext kCGLineCapRound CGContextSetLineWidth UIGraphicsGetCurrentContext..

Custom UISlider: avoid updating when dragging outside

http://stackoverflow.com/questions/8287413/custom-uislider-avoid-updating-when-dragging-outside

touchLocation touches anyObject locationInView self if touchLocation.x 0 touchLocation.y 0 return if touchLocation.x self.bounds.size.width touchLocation.y self.bounds.size.height return super touchesBegan touches withEvent event void touchesMoved NSSet touches.. touchLocation touches anyObject locationInView self if touchLocation.x 0 touchLocation.y 0 return if touchLocation.x self.bounds.size.width touchLocation.y self.bounds.size.height return super touchesMoved touches withEvent event void touchesEnded NSSet touches.. touchLocation touches anyObject locationInView self if touchLocation.x 0 touchLocation.y 0 return if touchLocation.x self.bounds.size.width touchLocation.y self.bounds.size.height return super touchesEnded touches withEvent event void touchesCancelled NSSet touches..