Fry
Fry

Reputation: 6275

SDK 6.1 UITextAlignment error

I have a project writed under iOS6, that is compliant with iOS5 or plus. Recently I re-open the project and I have this very strange error

enter image description here

But in all my other project this line work fine. What is the problem ?

Thanks !

Upvotes: 0

Views: 336

Answers (1)

rmaddy
rmaddy

Reputation: 318794

The older UITextAlignment enum was deprecated in iOS 6.0. It has been replaced with the NSTextAlignment enum. Newer versions of the compiler (with newer versions of Xcode) are more strict about this.

Since your Base SDK is iOS 6.1 (based on the title of your question), the compiler complains that you are using the wrong enum value.

Your Deployment Target has no bearing on the compiler messages. The good news is that the newer enum is backward compatible with the older enum as long as you stick to the Left, Center, and Right values.

Change your code to:

_cartaServiziLabel.textAlignment = NSTextAlignmentCenter;

and your code will compile and it will work with iOS 2.0 and later.

Upvotes: 3

Related Questions