tags:

views:

1460

answers:

2

I want to develop an iPhone application using the utility template, where the flip side is semi-transparent displaying the contents of the main view, flipped horizontally.

Edit: To create the illusion of semi-transparent flip side, I'd display the same content on the flip view as in the main view, but mirror the content and lower the alpha.

Is it possible to display a text using an UILabel, but mirror the text, ie flip it horizontally? Apple dev pages does not give me any help in this issue.

A: 

In the Utility template, the flipside isn't shown semi-transparent. This is most likely for performance reasons on the iPhone. I'm not sure there's any value to having your label flipped if it's not providing any functionality.

That said, I'd look into UIView's transform property.

August
+5  A: 

As August said, I'm not sure of your use case on this, but there's a reasonably straightforward way to do it using Core Animation. First, you'll need to add the QuartzCore framework to your project and do a

#import <QuartzCore/QuartzCore.h>

somewhere in your headers.

Then, you can apply a rotational transform to your UILabel's underlying layer using the following:

yourLabel.layer.transform = CATransform3DMakeRotation(M_PI, 0.0f, 1.0f, 0.0f);

which will rotate the label's CALayer by 180 degrees (pi radians) about the Y axis, producing the mirror effect you're looking for.

Brad Larson