2011-10-27 30 views
7

Tôi nhận được cảnh báo trong dòng chủ đề ở trên khi chạy ứng dụng của tôi trong xCode 4.3.Chuyển đổi ngầm định từ kiểu liệt kê 'UIBarButtonSystemItem' thành kiểu liệt kê khác 'UIBarButtonItemStyle' - iPad - iOS5

Đây là mã vi phạm:

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

bất cứ ai có thể giúp đỡ?

Cảm ơn bạn!

Trả lời

13

UIBarButtonSystemItemDone phải là UIBarButtonItemStyleDone. Mục hệ thống được sử dụng theo phương pháp init khác - initWithBarButtonSystemItem: - điều này thực sự có thể tốt hơn cho bạn vì nó sẽ trả về nút được thực hiện cục bộ thay vì văn bản cố định mà bạn có bây giờ.

+2

+1, chính xác câu trả lời đúng. –

+0

đặt liên kết này để trả lời để hoàn thành. [style phải là một trong các hằng số được định nghĩa trong UIBarButtonItemStyle] (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) –

Các vấn đề liên quan