2011-10-27 7 views
7

xCode 4.3でアプリケーションを実行しているときに上記の件名に警告が表示されます。ここで列挙型 'UIBarButtonSystemItem'から異なる列挙型 'UIBarButtonItemStyle'への暗黙の変換 - iPad - iOS5

は、問題のあるコードです:

UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:map]; 

    UIBarButtonItem *rightButton = [[UIBarButtonItem alloc] initWithTitle:@"Done" 
                    style:UIBarButtonSystemItemDone target:self action:@selector(removeCurrent)]; 
    map.navigationItem.rightBarButtonItem = rightButton; 

    [self presentModalViewController:navigationController animated:YES]; 

誰でも助けることができますか?

ありがとうございました!

答えて

13

UIBarButtonSystemItemDoneは、UIBarButtonItemStyleDoneである必要があります。システム項目は別のinitメソッド(initWithBarButtonSystemItem:)で使用されていますが、現時点では固定テキストではなくローカライズされた完了ボタンが返されるため、実際にはあなたの方が良いかもしれません。

+2

+1、正解です。 –

+0

このリンクを入力して完了してください。 [スタイルはUIBarButtonItemStyleで定義された定数の1つでなければなりません](http://developer.apple.com/library/ios/#documentation/uikit/reference/UIBarButtonItem_Class/Reference/Reference.html)AND [UIBarButtonItemStyle typedef](http: //developer.apple.com/library/ios/#documentation/uikit/reference/UIBarButtonItem_Class/Reference/Reference.html) –