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

时间:2022-01-13 16:06:57

I am getting the warning in the subject line above when running my app under xCode 4.3.

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

Here is the offending code :

这是违规代码:

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

Can anyone help ?

有人可以帮忙吗?

Thank you !

谢谢 !

1 个解决方案

#1


13  

UIBarButtonSystemItemDone should be UIBarButtonItemStyleDone. System item is used in a different init method - initWithBarButtonSystemItem: - which may actually be better for you as it will return a localised done button rather than the fixed text you have now.

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

#1


13  

UIBarButtonSystemItemDone should be UIBarButtonItemStyleDone. System item is used in a different init method - initWithBarButtonSystemItem: - which may actually be better for you as it will return a localised done button rather than the fixed text you have now.

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