uibarbuttonitem

UITabbar in Xcode 6

若如初见. 提交于 2019-12-06 11:18:59
I have UITabbarController with 4 tabs in iPhone 4, 4s, 5, 5S it is woking fine with tabbar item image But in iPhone 6 and iPhone 6 plus is looking wired. Is it need to put different images for both iPhone 6 and iPhone 6 plus ? How can I set this images. in iphone 6 And, iPhone 6 Plus I ran into this same issue. The problem here is not only the different resolution, but the fact that the size of the bounds is actually wider for iphone 6 and iphone 6 plus. By running the simulator on all different phone types I found the following: Tab bar Bounds iPhone 6 plus: 414 x 49 iPhone 6: 375 x 49 iPhone

UIBarButton with CustomView and a Border

倾然丶 夕夏残阳落幕 提交于 2019-12-06 09:28:59
I've subclassed UIBarButtonItem and am trying to make a button which dispays a refresh image normally, but an activity spinner when loading. The problem I have is I can't get the bordered style to display a custom view inside. It just doesn't appear. This is my code (from my UIBarButtonItem subclass's constructor): self = [super initWithTitle:@"" style:UIBarButtonItemStyleBordered target:self action:nil]; UIView *viwInner = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 24,24)]; [self.customView addSubview:viwInner]; self.btnStandard = [UIButton buttonWithType:UIButtonTypeCustom]; [self

UIBarButtonItems not showing up on UIToolbar

▼魔方 西西 提交于 2019-12-06 08:53:22
I have a UINavigationController with toolbarHidden set to NO. I have added UIBarButtonItems to navigationController.toolbar. The toolbar is displayed, but the buttons are not... What gives? Ok so apparently I misunderstood the usage of the setItems method on navigationController. To remedy this I set the toolbar items on each view controller that is pushed onto the navigation controller's stack. I guess if I wanted to have one toolbar persist through all the views I could add a new toolbar to the view controller holding my navigation controller then simply invoke setItems on my navigation

How to show/hide a search bar inside a navigation bar (iOS 8) as in Apple's Calendar app?

百般思念 提交于 2019-12-06 07:35:08
How to implement: I have UIBarButtonItem with a search icon, after I click on it, I want to show the search bar in navigation bar and on click cancel button in search bar, I want to show navigation bar without search and with buttons and title like in IOS 7 calendar app. Setup an action for your search button to present a UISearchController . See the Search > Present Over Navigation Bar demo in Apple's UICatalog sample code : - (IBAction)searchButtonClicked:(UIBarButtonItem *)sender { // Create the search results view controller and use it for the UISearchController.

UIToolbar Resizing causes weird UIBarButtonItem size in Landscape

北慕城南 提交于 2019-12-06 07:32:44
When I create and add a UIToolBar and UIBarButton items, how can I get the toolbar and items to appear properly in both orientations. This is what I have so far: self.toolbar = [[[UIToolbar alloc]initWithFrame:CGRectMake(0, 372, 320, 44)]autorelease]; self.toolbar.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; self.deleteButton = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemTrash target:self action:@selector(deleteButtonClicked)] autorelease]; self.deleteButton.style =

UISearchBar in UINavigationBar can't add UIBarButtonItem

Deadly 提交于 2019-12-06 04:38:06
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? Dumb error from mine. When using self.searchDisplayController.displaysSearchBarInNavigationBar = YES; You need to use self.searchDisplayController.navigationItem to add the UIBarButtons. Now it is working properly. For others viewing this thread, elaborating Ben's answer is what worked for me

Center elements vertically inside UINavigationBar with custom height

落花浮王杯 提交于 2019-12-06 04:35:58
问题 I'm developing an iOS 6 and 7 app that requires the navigation bar to be taller than the usual 44/64 pts I've searched high and low and so far it seems the cleanest solution is to use a category (or subclass) and implement the - (CGSize)sizeThatFits:(CGSize)size method to return a different size. This works fine in just making , however doing this causes all the items inside to rest at the bottom of the navigation bar, while I'd like to have them centered. I have tried using the Appearance

How to add a standard info button to a navigation bar in iOS?

ぐ巨炮叔叔 提交于 2019-12-06 03:06:16
I'd like to add a right bar button with the system's info icon to a navigation bar. But I see that UIBarButtonSystemItem does not provide such type of button. On the other hand, so I tried with a UIButton of type UIButtonType.infoLight , but I am not allowed to assign it to navigationItem.rightBarButtonItems . Is there any way to do this? this can be achieved using UIButton object of type .infoLight let infoButton = UIButton(type: .infoLight) infoButton.addTarget(self, action: #selector(infoButtonTapped), forControlEvents: .TouchUpInside) let barButton = UIBarButtonItem(customView: infoButton)

How to detect when MKUserTrackingBarButtonItem is used

為{幸葍}努か 提交于 2019-12-06 03:02:37
问题 I'm currently trying to find a way to detect when the MKUserTrackingBarButtonItem is used, other than deal with the mapView:didUpdateUserLocation: delegate method. I tried to setAction of the MKUserTrackingBarButtonItem to call my function (check this thread), but of curse it removes the updating location action, which I don't want. I don't find any delegate method triggered :/ Thanks for any idea. 回答1: If your MKUserTrackingBarButtonItem has been assigned a MKMapView to operate on then the

UIBarButtonItem-Badge for iOS

别说谁变了你拦得住时间么 提交于 2019-12-06 02:49:54
I am using this control for showing badge on barbuttonitem. It works fine for the first controller or root controller in navigation controller stack. While pushing to another controller, I tried to show badge and I cannot see any effect there. You should first time set badgeValue in viewDidLayoutSubviews . In this case it'll appear and don't blink, like if you set it in viewDidAppear : - (void)viewDidLayoutSubviews { barButton.badgeValue = @"5"; } Setting navigationItem in viewDidLayoutSubviews is not recommended because it is not semantic. The key to your problem is that the badge view is