Wednesday, April 4, 2012

Think different

ThinkDifferent-Original

Good things are always inspirational, this ad not only inspired a lot of Appler, but also encouraged me to do what I want to do.

Many thanks to Steve Jobs. I will always miss you.

The scripts

Here’s to the crazy ones. The misfits. The rebels. The troublemakers. The round pegs in the square holes. The ones who see things differently.

They’re not fond of rules. And they have no respect for the status quo.

You can quote them, disagree with them, glorify or vilify them. About the only thing you can’t do is ignore them. Because they change things. They push the human race forward.

While some may see them as the crazy ones, we see genius. Because the people who are crazy enough to think they can change the world, are the ones who do.

The video

Think different(HD)

The icon of TextEdit.app



Via Tonny Xu http://feedproxy.google.com/~r/tonnyxu/~3/n7eWwaXnJio/ Something really cool!

Monday, April 2, 2012

Make the UITableView with group style to round the image.

The point is, the roundCorner is draw by a subview of UITableViewCell, and mean while, it’s not a public class, there is no way you can get layer.cornerRadius from any view. So we need to resolve this problem by ourselves.

There are 2 cases.

  1. There is only one cell.

    This case is ease, just use cell.contentView.layer.cornerRadius and cell.contentView.layer.masksToBounds to make it work.

  2. There are more than one cell.

    This case is a little bit difficult. We need to deal each cell separately. Use the cell.contentView.layer.mask property to make it work. The first cell and the last cell has different round corner position. So draw the path and make it work.



Via Tonny Xu http://feedproxy.google.com/~r/tonnyxu/~3/K05PnoAt1yo/ iPhone Dev, Programming, Tips

Which direction is `UIImageOrientationUp`

UIImage has a good property named imageOrientation, all the images taken by iPhone/iPad is stored in physical orientation, when draw it on the view, most of the UIKit API and CoreGraphic API can recognize the orientation and render it it correct orientation. But if you need to resize the image or do some effect on the image by yourself, you need to calculate the image orientation by yourself. Thus you MUST understand which direction is UIImageOrientationUp.

The possible orientations

The UIImage header file defined the orientations as:

 typedef enum {     UIImageOrientationUp,            // default orientation     UIImageOrientationDown,          // 180 deg rotation     UIImageOrientationLeft,          // 90 deg CCW     UIImageOrientationRight,         // 90 deg CW     UIImageOrientationUpMirrored,    // as above but image mirrored along other axis. horizontal flip     UIImageOrientationDownMirrored,  // horizontal flip     UIImageOrientationLeftMirrored,  // vertical flip     UIImageOrientationRightMirrored, // vertical flip } UIImageOrientation;  

Fine, it is commented, but, hmm, no so well. Could you tell me which direction is the UIImageOrientationUp?

The UP orientation

It’s not the orientation when you hold your iPhone in the normal mode. Make a guess!

OK, I know your guys are not so patient, so,

Here is the correct answer: this orientation is the UP!

The UP orientation when you take a photo on iPhone



Via Tonny Xu http://feedproxy.google.com/~r/tonnyxu/~3/RkjWuse3NYI/ iPhone Dev, Tips

Use `DEPRECATED_ATTRIBUTE` to clean up your code

What is DEPRECATED_ATTRIBUTE

Actually, DEPRECATED_ATTRIBUTE is a macro, it is defined as:

 /*  * only certain compilers support __attribute__((deprecated))  */ #if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)))     #define DEPRECATED_ATTRIBUTE __attribute__((deprecated)) #else     #define DEPRECATED_ATTRIBUTE