iphone Programming Glossary: cgrectmake
How to make a UITextField move up when keyboard is present http://stackoverflow.com/questions/1126726/how-to-make-a-uitextfield-move-up-when-keyboard-is-present void textFieldDidBeginEditing UITextField textField Keyboard becomes visible scrollView.frame CGRectMake scrollView.frame.origin.x scrollView.frame.origin.y scrollView.frame.size.width scrollView.frame.size.height.. 50 resize void textFieldDidEndEditing UITextField textField keyboard will hide scrollView.frame CGRectMake scrollView.frame.origin.x scrollView.frame.origin.y scrollView.frame.size.width scrollView.frame.size.height..
How to Rotate a UIImage 90 degrees? http://stackoverflow.com/questions/1315251/how-to-rotate-a-uiimage-90-degrees bitmap radians 90 CGContextTranslateCTM bitmap 0 targetHeight CGContextDrawImage bitmap CGRectMake 0 0 targetWidth targetHeight imageRef CGImageRef ref CGBitmapContextCreateImage bitmap UIImage newImage..
How do I create a basic UIButton programmatically? http://stackoverflow.com/questions/1378765/how-do-i-create-a-basic-uibutton-programmatically
Detecting which UIButton was pressed in a UITableView http://stackoverflow.com/questions/1802707/detecting-which-uibutton-was-pressed-in-a-uitableview reuseIdentifier identifier cell autorelelase UIButton button UIButton alloc initWithFrame CGRectMake 10 5 40 20 button addTarget self action @selector buttonPressedAction forControlEvents UIControlEventTouchUpInside.. reuseIdentifier identifier cell autorelelase UIButton button UIButton alloc initWithFrame CGRectMake 10 5 40 20 button addTarget self action @selector buttonPressedAction forControlEvents UIControlEventTouchUpInside..
The simplest way to resize an UIImage? http://stackoverflow.com/questions/2658738/the-simplest-way-to-resize-an-uiimage to force exact pixel size. UIGraphicsBeginImageContextWithOptions newSize NO 0.0 image drawInRect CGRectMake 0 0 newSize.width newSize.height UIImage newImage UIGraphicsGetImageFromCurrentImageContext UIGraphicsEndImageContext..
How do I export UIImage array as a movie? http://stackoverflow.com/questions/3741323/how-do-i-export-uiimage-array-as-a-movie NSParameterAssert context CGContextConcatCTM context frameTransform CGContextDrawImage context CGRectMake 0 0 CGImageGetWidth image CGImageGetHeight image image CGColorSpaceRelease rgbColorSpace CGContextRelease..
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 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..
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 c borderColor CGColor if position CustomCellBackgroundViewPositionTop CGContextFillRect c CGRectMake 0.0f rect.size.height 10.0f rect.size.width 10.0f CGContextBeginPath c CGContextMoveToPoint c 0.0f rect.size.height.. c rect.size.width rect.size.height 10.0f CGContextStrokePath c CGContextClipToRect c CGRectMake 0.0f 0.0f rect.size.width rect.size.height 10.0f else if position CustomCellBackgroundViewPositionBottom.. rect.size.height 10.0f else if position CustomCellBackgroundViewPositionBottom CGContextFillRect c CGRectMake 0.0f 0.0f rect.size.width 10.0f CGContextBeginPath c CGContextMoveToPoint c 0.0f 10.0f CGContextAddLineToPoint..
How to filter NSFetchedResultsController (CoreData) with UISearchDisplayController/UISearchBar http://stackoverflow.com/questions/4471289/how-to-filter-nsfetchedresultscontroller-coredata-with-uisearchdisplaycontroll information void loadView super loadView UISearchBar searchBar UISearchBar alloc initWithFrame CGRectMake 0 0 self.tableView.frame.size.width 44.0 autorelease searchBar.autoresizingMask UIViewAutoresizingFlexibleWidth..
iOS UIImagePickerController result image orientation after upload http://stackoverflow.com/questions/5427656/ios-uiimagepickercontroller-result-image-orientation-after-upload case UIImageOrientationRight case UIImageOrientationRightMirrored Grr... CGContextDrawImage ctx CGRectMake 0 0 self.size.height self.size.width self.CGImage break default CGContextDrawImage ctx CGRectMake 0.. CGRectMake 0 0 self.size.height self.size.width self.CGImage break default CGContextDrawImage ctx CGRectMake 0 0 self.size.width self.size.height self.CGImage break And now we just create a new UIImage from the..
What's the easiest way to resize/optimize an image size with the iPhone SDK? http://stackoverflow.com/questions/612131/whats-the-easiest-way-to-resize-optimize-an-image-size-with-the-iphone-sdk UIImage image scaledToSize CGSize newSize UIGraphicsBeginImageContext newSize image drawInRect CGRectMake 0 0 newSize.width newSize.height UIImage newImage UIGraphicsGetImageFromCurrentImageContext UIGraphicsEndImageContext..
Locking the Fields in MFMailComposeViewController http://stackoverflow.com/questions/6284599/locking-the-fields-in-mfmailcomposeviewcontroller fade the overlay in loadingLabel @ Sending Test Drive... bgimage UIImageView alloc initWithFrame CGRectMake 0 0 320 480 bgimage.image UIImage imageNamed @ waitOverLay.png self.view addSubview bgimage bgimage.alpha.. UIActivityIndicatorViewStyleWhiteLarge spinner.hidden FALSE spinner.frame CGRectMake 137 160 50 50 spinner setHidesWhenStopped YES self.view addSubview spinner self.view bringSubviewToFront..
Custom colors in UITabBar http://stackoverflow.com/questions/675433/custom-colors-in-uitabbar CustomUITabBarController @synthesize tabBar1 void viewDidLoad super viewDidLoad CGRect frame CGRectMake 0.0 0 self.view.bounds.size.width 48 UIView v UIView alloc initWithFrame frame v setBackgroundColor..
How to make a UITextField move up when keyboard is present http://stackoverflow.com/questions/1126726/how-to-make-a-uitextfield-move-up-when-keyboard-is-present when the keyboard goes up and down. I'm simply using void textFieldDidBeginEditing UITextField textField Keyboard becomes visible scrollView.frame CGRectMake scrollView.frame.origin.x scrollView.frame.origin.y scrollView.frame.size.width scrollView.frame.size.height 215 50 resize void textFieldDidEndEditing UITextField.. scrollView.frame.size.width scrollView.frame.size.height 215 50 resize void textFieldDidEndEditing UITextField textField keyboard will hide scrollView.frame CGRectMake scrollView.frame.origin.x scrollView.frame.origin.y scrollView.frame.size.width scrollView.frame.size.height 215 50 resize However this doesn't automatically move..
How to Rotate a UIImage 90 degrees? http://stackoverflow.com/questions/1315251/how-to-rotate-a-uiimage-90-degrees sourceImage.imageOrientation UIImageOrientationUp CGContextRotateCTM bitmap radians 90 CGContextTranslateCTM bitmap 0 targetHeight CGContextDrawImage bitmap CGRectMake 0 0 targetWidth targetHeight imageRef CGImageRef ref CGBitmapContextCreateImage bitmap UIImage newImage UIImage imageWithCGImage ref CGContextRelease bitmap CGImageRelease..
How do I create a basic UIButton programmatically? http://stackoverflow.com/questions/1378765/how-do-i-create-a-basic-uibutton-programmatically
Detecting which UIButton was pressed in a UITableView http://stackoverflow.com/questions/1802707/detecting-which-uibutton-was-pressed-in-a-uitableview nil cell UITableView alloc initWithStyle UITableViewCellStyleDefault reuseIdentifier identifier cell autorelelase UIButton button UIButton alloc initWithFrame CGRectMake 10 5 40 20 button addTarget self action @selector buttonPressedAction forControlEvents UIControlEventTouchUpInside button setTag 1 cell.contentView addSubview button.. nil cell UITableView alloc initWithStyle UITableViewCellStyleDefault reuseIdentifier identifier cell autorelelase UIButton button UIButton alloc initWithFrame CGRectMake 10 5 40 20 button addTarget self action @selector buttonPressedAction forControlEvents UIControlEventTouchUpInside cell.contentView addSubview button button release..
The simplest way to resize an UIImage? http://stackoverflow.com/questions/2658738/the-simplest-way-to-resize-an-uiimage factor and thus account for Retina resolution . Pass 1.0 to force exact pixel size. UIGraphicsBeginImageContextWithOptions newSize NO 0.0 image drawInRect CGRectMake 0 0 newSize.width newSize.height UIImage newImage UIGraphicsGetImageFromCurrentImageContext UIGraphicsEndImageContext return newImage Example usage #import MYUtil.h..
How do I export UIImage array as a movie? http://stackoverflow.com/questions/3741323/how-do-i-export-uiimage-array-as-a-movie 8 4 frameSize.width rgbColorSpace kCGImageAlphaNoneSkipFirst NSParameterAssert context CGContextConcatCTM context frameTransform CGContextDrawImage context CGRectMake 0 0 CGImageGetWidth image CGImageGetHeight image image CGColorSpaceRelease rgbColorSpace CGContextRelease context CVPixelBufferUnlockBaseAddress pxbuffer 0 return..
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 MAX scaleForWidth scaleForHeight CGSize imageSize 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 imageRect baseImage..
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 c fillColor CGColor CGContextSetStrokeColorWithColor c borderColor CGColor if position CustomCellBackgroundViewPositionTop CGContextFillRect c CGRectMake 0.0f rect.size.height 10.0f rect.size.width 10.0f CGContextBeginPath c CGContextMoveToPoint c 0.0f rect.size.height 10.0f CGContextAddLineToPoint c 0.0f rect.size.height.. c rect.size.width rect.size.height CGContextAddLineToPoint c rect.size.width rect.size.height 10.0f CGContextStrokePath c CGContextClipToRect c CGRectMake 0.0f 0.0f rect.size.width rect.size.height 10.0f else if position CustomCellBackgroundViewPositionBottom CGContextFillRect c CGRectMake 0.0f 0.0f rect.size.width.. CGContextClipToRect c CGRectMake 0.0f 0.0f rect.size.width rect.size.height 10.0f else if position CustomCellBackgroundViewPositionBottom CGContextFillRect c CGRectMake 0.0f 0.0f rect.size.width 10.0f CGContextBeginPath c CGContextMoveToPoint c 0.0f 10.0f CGContextAddLineToPoint c 0.0f 0.0f CGContextStrokePath c CGContextBeginPath..
How to filter NSFetchedResultsController (CoreData) with UISearchDisplayController/UISearchBar http://stackoverflow.com/questions/4471289/how-to-filter-nsfetchedresultscontroller-coredata-with-uisearchdisplaycontroll tableView endUpdates Other view information void loadView super loadView UISearchBar searchBar UISearchBar alloc initWithFrame CGRectMake 0 0 self.tableView.frame.size.width 44.0 autorelease searchBar.autoresizingMask UIViewAutoresizingFlexibleWidth searchBar.autocorrectionType UITextAutocorrectionTypeNo..
iOS UIImagePickerController result image orientation after upload http://stackoverflow.com/questions/5427656/ios-uiimagepickercontroller-result-image-orientation-after-upload UIImageOrientationLeft case UIImageOrientationLeftMirrored case UIImageOrientationRight case UIImageOrientationRightMirrored Grr... CGContextDrawImage ctx CGRectMake 0 0 self.size.height self.size.width self.CGImage break default CGContextDrawImage ctx CGRectMake 0 0 self.size.width self.size.height self.CGImage break And now.. Grr... CGContextDrawImage ctx CGRectMake 0 0 self.size.height self.size.width self.CGImage break default CGContextDrawImage ctx CGRectMake 0 0 self.size.width self.size.height self.CGImage break And now we just create a new UIImage from the drawing context CGImageRef cgimg CGBitmapContextCreateImage..
What's the easiest way to resize/optimize an image size with the iPhone SDK? http://stackoverflow.com/questions/612131/whats-the-easiest-way-to-resize-optimize-an-image-size-with-the-iphone-sdk in this post with the relevant code UIImage imageWithImage UIImage image scaledToSize CGSize newSize UIGraphicsBeginImageContext newSize image drawInRect CGRectMake 0 0 newSize.width newSize.height UIImage newImage UIGraphicsGetImageFromCurrentImageContext UIGraphicsEndImageContext return newImage As far as storage of the image..
Locking the Fields in MFMailComposeViewController http://stackoverflow.com/questions/6284599/locking-the-fields-in-mfmailcomposeviewcontroller nil alert show alert release void createWaitOverlay fade the overlay in loadingLabel @ Sending Test Drive... bgimage UIImageView alloc initWithFrame CGRectMake 0 0 320 480 bgimage.image UIImage imageNamed @ waitOverLay.png self.view addSubview bgimage bgimage.alpha 0 bgimage addSubview loadingLabel loadingLabel.alpha 0.. startSpinner spinner UIActivityIndicatorView alloc initWithActivityIndicatorStyle UIActivityIndicatorViewStyleWhiteLarge spinner.hidden FALSE spinner.frame CGRectMake 137 160 50 50 spinner setHidesWhenStopped YES self.view addSubview spinner self.view bringSubviewToFront spinner spinner startAnimating void stopSpinner spinner..
Custom colors in UITabBar http://stackoverflow.com/questions/675433/custom-colors-in-uitabbar #import CustomUITabBarController.h @implementation CustomUITabBarController @synthesize tabBar1 void viewDidLoad super viewDidLoad CGRect frame CGRectMake 0.0 0 self.view.bounds.size.width 48 UIView v UIView alloc initWithFrame frame v setBackgroundColor UIColor alloc initWithRed 1.0 green 0.0 blue 0.0 alpha..
How to make a UITextField move up when keyboard is present http://stackoverflow.com/questions/1126726/how-to-make-a-uitextfield-move-up-when-keyboard-is-present down. I'm simply using void textFieldDidBeginEditing UITextField textField Keyboard becomes visible scrollView.frame CGRectMake scrollView.frame.origin.x scrollView.frame.origin.y scrollView.frame.size.width scrollView.frame.size.height 215 50 resize.. 215 50 resize void textFieldDidEndEditing UITextField textField keyboard will hide scrollView.frame CGRectMake scrollView.frame.origin.x scrollView.frame.origin.y scrollView.frame.size.width scrollView.frame.size.height 215 50 resize..
How to Rotate a UIImage 90 degrees? http://stackoverflow.com/questions/1315251/how-to-rotate-a-uiimage-90-degrees CGContextRotateCTM bitmap radians 90 CGContextTranslateCTM bitmap 0 targetHeight CGContextDrawImage bitmap CGRectMake 0 0 targetWidth targetHeight imageRef CGImageRef ref CGBitmapContextCreateImage bitmap UIImage newImage UIImage imageWithCGImage..
How do I create a basic UIButton programmatically? http://stackoverflow.com/questions/1378765/how-do-i-create-a-basic-uibutton-programmatically
Detecting which UIButton was pressed in a UITableView http://stackoverflow.com/questions/1802707/detecting-which-uibutton-was-pressed-in-a-uitableview UITableViewCellStyleDefault reuseIdentifier identifier cell autorelelase UIButton button UIButton alloc initWithFrame CGRectMake 10 5 40 20 button addTarget self action @selector buttonPressedAction forControlEvents UIControlEventTouchUpInside button.. UITableViewCellStyleDefault reuseIdentifier identifier cell autorelelase UIButton button UIButton alloc initWithFrame CGRectMake 10 5 40 20 button addTarget self action @selector buttonPressedAction forControlEvents UIControlEventTouchUpInside cell.contentView..
The simplest way to resize an UIImage? http://stackoverflow.com/questions/2658738/the-simplest-way-to-resize-an-uiimage . Pass 1.0 to force exact pixel size. UIGraphicsBeginImageContextWithOptions newSize NO 0.0 image drawInRect CGRectMake 0 0 newSize.width newSize.height UIImage newImage UIGraphicsGetImageFromCurrentImageContext UIGraphicsEndImageContext return..
How do I export UIImage array as a movie? http://stackoverflow.com/questions/3741323/how-do-i-export-uiimage-array-as-a-movie NSParameterAssert context CGContextConcatCTM context frameTransform CGContextDrawImage context CGRectMake 0 0 CGImageGetWidth image CGImageGetHeight image image CGColorSpaceRelease rgbColorSpace CGContextRelease context CVPixelBufferUnlockBaseAddress..
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 imageSize 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..
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 c borderColor CGColor if position CustomCellBackgroundViewPositionTop CGContextFillRect c CGRectMake 0.0f rect.size.height 10.0f rect.size.width 10.0f CGContextBeginPath c CGContextMoveToPoint c 0.0f rect.size.height 10.0f.. CGContextAddLineToPoint c rect.size.width rect.size.height 10.0f CGContextStrokePath c CGContextClipToRect c CGRectMake 0.0f 0.0f rect.size.width rect.size.height 10.0f else if position CustomCellBackgroundViewPositionBottom CGContextFillRect.. rect.size.width rect.size.height 10.0f else if position CustomCellBackgroundViewPositionBottom CGContextFillRect c CGRectMake 0.0f 0.0f rect.size.width 10.0f CGContextBeginPath c CGContextMoveToPoint c 0.0f 10.0f CGContextAddLineToPoint c 0.0f 0.0f..
How to filter NSFetchedResultsController (CoreData) with UISearchDisplayController/UISearchBar http://stackoverflow.com/questions/4471289/how-to-filter-nsfetchedresultscontroller-coredata-with-uisearchdisplaycontroll endUpdates Other view information void loadView super loadView UISearchBar searchBar UISearchBar alloc initWithFrame CGRectMake 0 0 self.tableView.frame.size.width 44.0 autorelease searchBar.autoresizingMask UIViewAutoresizingFlexibleWidth searchBar.autocorrectionType..
iOS UIImagePickerController result image orientation after upload http://stackoverflow.com/questions/5427656/ios-uiimagepickercontroller-result-image-orientation-after-upload case UIImageOrientationRight case UIImageOrientationRightMirrored Grr... CGContextDrawImage ctx CGRectMake 0 0 self.size.height self.size.width self.CGImage break default CGContextDrawImage ctx CGRectMake 0 0 self.size.width self.size.height.. ctx CGRectMake 0 0 self.size.height self.size.width self.CGImage break default CGContextDrawImage ctx CGRectMake 0 0 self.size.width self.size.height self.CGImage break And now we just create a new UIImage from the drawing context CGImageRef..
What's the easiest way to resize/optimize an image size with the iPhone SDK? http://stackoverflow.com/questions/612131/whats-the-easiest-way-to-resize-optimize-an-image-size-with-the-iphone-sdk UIImage imageWithImage UIImage image scaledToSize CGSize newSize UIGraphicsBeginImageContext newSize image drawInRect CGRectMake 0 0 newSize.width newSize.height UIImage newImage UIGraphicsGetImageFromCurrentImageContext UIGraphicsEndImageContext return..
Locking the Fields in MFMailComposeViewController http://stackoverflow.com/questions/6284599/locking-the-fields-in-mfmailcomposeviewcontroller createWaitOverlay fade the overlay in loadingLabel @ Sending Test Drive... bgimage UIImageView alloc initWithFrame CGRectMake 0 0 320 480 bgimage.image UIImage imageNamed @ waitOverLay.png self.view addSubview bgimage bgimage.alpha 0 bgimage addSubview.. alloc initWithActivityIndicatorStyle UIActivityIndicatorViewStyleWhiteLarge spinner.hidden FALSE spinner.frame CGRectMake 137 160 50 50 spinner setHidesWhenStopped YES self.view addSubview spinner self.view bringSubviewToFront spinner spinner..
Custom colors in UITabBar http://stackoverflow.com/questions/675433/custom-colors-in-uitabbar @implementation CustomUITabBarController @synthesize tabBar1 void viewDidLoad super viewDidLoad CGRect frame CGRectMake 0.0 0 self.view.bounds.size.width 48 UIView v UIView alloc initWithFrame frame v setBackgroundColor UIColor alloc initWithRed..
|