Davidin073
Davidin073

Reputation: 1011

Xcode4: Implicit conversion from enumeration type 'UIBarStyle' to different enumeration type 'UIBarButtonItemStyle'

I have this code:

UIBarButtonItem *backButton = [[UIBarButtonItem alloc]initWithTitle: @"Secciones" 
                                                                  style: UIBarStyleDefault
                                                                 target:nil 
                                                                 action:nil];

and on the line that says style: UIBarStyleDefault I get the following warning:

Implicit conversion from enumeration type 'UIBarStyle' to different enumeration type 'UIBarButtonItemStyle'

Upvotes: 1

Views: 2006

Answers (1)

fresskoma
fresskoma

Reputation: 25781

You shouldn't be a using UIBarStyle, but a UIBarButtonItemStyles instead (which is, as the name suggests, meant to be used for UIBarButtonItems):

UIBarButtonItem *backButton = [[UIBarButtonItem alloc]
    initWithTitle: @"Secciones" 
    style: UIBarButtonItemStylePlain
    target:nil 
    action:nil
];

Upvotes: 6

Related Questions