uibarbuttonitem

UISearchBar in UINavigationBar can't add UIBarButtonItem

青春壹個敷衍的年華 提交于 2020-01-02 16:53:39
问题 I'm trying to add a UISearchBar to a UINavigationbar using self.searchDisplayController.displaysSearchBarInNavigationBar = YES; The UISearchBar gets added quite well into the UINavigationBar, but the left/right UIBarButtons are gone. I just can't figure out how to add them. Andy ideas or examples on this? 回答1: Dumb error from mine. When using self.searchDisplayController.displaysSearchBarInNavigationBar = YES; You need to use self.searchDisplayController.navigationItem to add the UIBarButtons

text color of disabled uibarbuttonitem is always the color of the normal state

僤鯓⒐⒋嵵緔 提交于 2020-01-02 05:33:55
问题 i wrote in my code [[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil] setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor lightGrayColor], NSFontAttributeName:[UIFont boldSystemFontOfSize:16.0f]} forState:UIControlStateDisabled]; [[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil] setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor blueColor], NSFontAttributeName:[UIFont boldSystemFontOfSize:16.0f]} forState

Adjust width of UITextField to fill toolbar in landscape

爱⌒轻易说出口 提交于 2020-01-02 03:40:27
问题 In a UIToolbar , I have added a UITextField to the middle of the bar (which gets added as a UIBarButtonItem ) with another UIBarButtonItem (Action button) next to it. I added flexible space bar button items at the very left and very right. It looks great on portrait, but when I rotate to landscape it centers them and looks ok, but I need the text field to get stretched to fill the width and push the last button clear to the right - exactly like it does in Messages - on iPhone and iPad. I

iOS 7: How to set UIBarButtonItem backButtonBackgroundImage for UIControlStateHighlighted?

☆樱花仙子☆ 提交于 2020-01-02 00:53:08
问题 I am trying to set the background image for back button in normal and highlighted states. - (void)configureBackButtonInNavigationItem:(UINavigationItem *)item { UIBarButtonItem *backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"back" style:UIBarButtonItemStyleBordered target:nil action:NULL]; [backBarButtonItem setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor]} forState:UIControlStateNormal]; [backBarButtonItem setTitleTextAttributes:@

Cant set image for UIBarButtonItem

三世轮回 提交于 2020-01-01 05:05:09
问题 I'm trying to set image for my UIBarButtonItem and I can't manage to do that. I tried two times, and in first case I get my image in right place, but when I click on button nothing happens (it should pop out a new window, but nothing works). There is the piece of code I have used: UIImage *faceImage = [UIImage imageNamed:@"plus_button.png"]; UIButton *face = [UIButton buttonWithType:UIButtonTypeCustom]; face.bounds = CGRectMake( 0, 0, faceImage.size.width, faceImage.size.height ); [face

UIBarButtonItem appearance trouble in iOS 7, could this be an Apple bug?

人盡茶涼 提交于 2020-01-01 03:10:51
问题 I saw an article a while back, which is here: User Interface Customization in iOS 6 It shows customization for iOS 6. Since the article I have written Apps that use the technique, it is pretty straightforward, no magic in there. However, I need to update one of my apps and under iOS 7 it does not work correctly. It appears that customization of UIBarButtonItems does not work the first time the view is presented. If I dismiss the view and then present it agin everything works fine. What is

iOS7 UILabel to adopt same tintColor as window

百般思念 提交于 2019-12-31 10:40:54
问题 I know that for elements of classes UIButton and UIBarButtonItem they automatically assume window.tintColor as the main colour, which results of an immediate change in case I set a new tintColor to window at any time in the app. I was wondering if there is any way to make UILabel elements to follow the same pattern, where once created they automatically assumer its default colour as window.tintColor and if changing window.tintColor at any time within my app runtime would also result in

Change color of UINavigationController back button

时光毁灭记忆、已成空白 提交于 2019-12-31 03:27:12
问题 I'm having problems trying to figure out how to change the color of the buttons on the navigation controller. Previously I had used the following: [[UIBarButtonItem appearance] setTintColor:[UIColor colorWithRed:226/255.0 green:66/255.0 blue:66/255.0 alpha:0.0]]; and this worked, but I added a new view with a toolbar, and the tool bar button images will not show. If I remove the global coloring, the tool bar items show just fine. I've tried setting the tint color on both the leftBarButtonItem

Navigation bar button image not showing in Swift

半腔热情 提交于 2019-12-30 17:27:07
问题 I'm back again. I'm writing an app in Swift using Xcode 7. I've added a navigation controller and on top of that a navigation item, and then a bar button. I'm trying to change the image of the bar button to a png that I've imported into Xcode. However, it just shows this in the design and also when I run the app. It just shows a blue smudge in the navigation area. I've tried importing the image into the project and also into images.xcassets with the same results. Anyone know what may be wrong

Rotate UIBarButtonItem

我是研究僧i 提交于 2019-12-30 10:53:09
问题 I want to rotate a UIBarButtonItem . I have been able to do this with UIButton s using setTransform:CGAffineTransformMakeRotation(…) , but UIBarButtonItem does not have this property. I know the Camera-app does this, so it should be achieveable. How can I achieve this? Thanks. 回答1: Have you tried using a custom view inside the UIBarButtonItem that you then transform any way you want? 回答2: UIBarButtonItem does not extend UIView, so it cannot be transformed directly. You can add the