tôi thêm một nút thanh để thanh điều hướng programitically như sauLàm thế nào để thay đổi màu font color/Tiêu đề của UIBarButtonItem trên thanh điều hướng
UIBarButtonItem *cancel = [[UIBarButtonItem alloc] initWithTitle:@"CANCEL" style:UIBarButtonItemStyleBordered target:self action:@selector(goToPreviousView)];
self.navigationItem.leftBarButtonItem = cancel;
Bây giờ tôi muốn hiển thị Text "CANCEL" trong RED Màu.
Tôi muốn thay đổi văn bản trên các mục nút thanh, nhưng không phải màu của nút.
Làm cách nào để thực hiện điều đó?
Kiểm tra những liên kết này http://stackoverflow.com/questions/3314035/how-can-i-change -the-font-color-of-a-uibarbutton-item và http://stackoverflow.com/questions/664930/uibarbuttonitem-with-color – IronManGill
Đối với iOS 5+, hãy xem câu trả lời này: http: // stackoverflow.com/questions/7810563/how-do-you-use-settitletextattributesforstate-in-uibaritem-in-ios-5-0 –