[英]How to get UIBarButtonItem UIViewController?
我有UIViewController
的參考。 從該參考中,我想獲得對所有導航欄和條按鈕項的參考,並在其上應用自定義樣式。
如何在iOS 5上實現此目的?
你可以做類似的事情。
[backbutton setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
[UIColor blackColor],UITextAttributeTextColor,[UIFont fontWithName:TEXTFONT size:16.0f],UITextAttributeFont,
nil] forState:UIControlStateNormal];
假設您的視圖控制器具有導航控制器,則應該能夠使用以下代碼訪問導航欄及其項:
UINavigationBar *navBar = [myViewController.navigationController.navigationBar];
NSArray *navBarItems = navBar.items;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.