$aleOrigin

Graphics

Please consider subscribing to Mobile Developer Tips
RSS feed or following us on Twitter


Converting Radians to Degrees and Degrees to Radians

In mathematics, a radian is often used as a standard unit of measure when expressing angles. For various methods in iOS classes that deal with angles and rotation, the parameters and return values are often in radians. My brain doesn’t think in radians, I visualize angles and rotations in degrees, hence the code in this [...]

Graphics

Creating Background Patterns

Beyond custom images and solid colors, a nice effect for a background is to use a repeating pattern. The code example that follows shows just how easy this is. For this example, I started with the image below, a photo that I took in the Fall with my iPhone. I downloaded and cropped the image [...]

Graphics

Drag an Image within the Bounds of Superview

This post demonstrates how to drag an image on screen, respecting the bounds of the images superview. The first step is to create a class that inherits from UIImageView, I’ll name the class ImageToDrag. There is only one instance variable in this class, currentPoint – a CGPoint structure which has an X and Y coordinate [...]

Graphics

How to Crop an Image

This post shows an example of one way to crop an image. Let’s begin by looking at a screenshot of the original and cropped image on the iPhone simulator: As you can see, I am cropping a rectangle from the middle of the image on the top left. The code below shows how to accomplished [...]

Graphics

Convert an Image (UIImage) to Grayscale

A trick you won’t need often, yet when the day arrives, you’ll have this up your sleeve – a quick method to convert a UIImage object to grayscale.

Graphics

Resize/Scale of an Image – Take 2 – Coding a Thread Safe Approach

In the first post on image resizing, How to Resize/Scale an Image using an Objective-C Category, I wrote barebones approach to resizing an image. This works well for simple cases, however this approach is not thread safe as it uses the global current context. I attended a recent Apple Tech Talk and one of the [...]

Graphics

Gotcha: Case Sensitive PNG Filename

Here’s one that will trip you up if you aren’t careful…look at this code: timerButton = [[UIButton alloc] initWithFrame:CGRectMake(104, 410, 50, 50)];   // Notice the filename "timer.png" [timerButton setBackgroundImage:[UIImage imageNamed:@"timer.png"] forState:UIControlStateNormal];   [timerButton addTarget:self action:@selector(buttonPressed:) forControlEvents: UIControlEventTouchUpInside];   [self.view addSubview:timerButton]; Simple enough, create a button, use the image timer.png for the normal state, and [...]

Graphics

Resize/Scale of an Image – Take 1 – Using an Objective-C Category

Editor’s Note: Part 2 of this post Resize/Scale of an Image – Take 2 – Thread Safe Approach takes this idea to the next level, showing how to dynamically resize images using thread safe code. Given how common it is to scale an image within an application, it’s surprising (at least to me) that such [...]

Graphics

Animated Gif – Animated Images – iPhone Style

Using animated gif and animated images with the iPhone SDK.

Graphics
All Content Copyright © 2008-2012 • Mobile Developer Tips, All Rights Reserved.
iPhone and iPad are registered trademarks of Apple, Inc.
iOS is a registered trademark of Cisco Technology, Inc.