从枚举类型'UIBarButtonSystemItem'到不同枚举类型'UIBarButtonItemStyle'的隐式转换 - iPad - iOS5

时间:2011-10-27 17:25:54

标签: iphone objective-c xcode ipad sdk

在xCode 4.3下运行我的应用程序时,我在上面的主题行中收到警告。

以下是有问题的代码:

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];

有人可以帮忙吗?

谢谢!

1 个答案:

答案 0 :(得分:13)

UIBarButtonSystemItemDone应为UIBarButtonItemStyleDone。系统项用于不同的init方法 - initWithBarButtonSystemItem: - 这实际上可能对您更好,因为它将返回本地化的完成按钮而不是您现在拥有的固定文本。