I recently dwelled into the world of Cocoa programing for the iPhone a few weeks back. My good friend and collegue at Avantime, Hampus, and I bought iPhones 3G when we were on vaccation in Italy this summer. Italy sells unlocked iPhones so we’re not stuck with using Telia which is the only Swedish operator who carry iPhone. I actually had a quick look at iPhone development when the first iPhone came out using the toolchain but I didn’t really enjoy it at the time, perhaps it’s because I only owned an iPod touch at the time.
Anyhow. Hampus and I have been hacking away on our first iPhone app and I thought I’d share some usefull code for rounding off corners of an UIImage. This code is based on various stuff I found on google but I made a nice image manipulation class which rounds of corners:
ImageManipulation.h
|
ImageManipulation.m
|
Just call the static method makeRoundCornerImage and pass your image to have the image rounded off the way you want.
Note that you do need the CoreGraphics framework for this to compile. By request I’ve also whipped up a small demo of how to use this. If you don’t like to copy-paste code you can grab the class files from the demo.
地址:http://blog.sallarp.com/iphone-uiimage-round-corners/