uibarbuttonitem

UIBarButtonItems not showing up on UIToolbar

∥☆過路亽.° 提交于 2019-12-22 13:10:24
问题 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? 回答1: 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

UIBarButtonItem remove Back Button Title - iOS 11

不羁的心 提交于 2019-12-22 08:20:48
问题 UIBarButtonItem.appearance().setBackButtonTitlePositionAdjustment(UIOffsetMake(0, -60), for:UIBarMetrics.default) I use above to remove the backButtonTitle prior to iOS 11. But on iOS 11 that is not properly working. Arrow shifts bit downwards. How to fix this? Edit: Other way by erasing Title can solve my problem but my concern is why that old way is not working anymore. 回答1: The other way is to set UINavigationControllerDelegate for your navigationController and erase the title in its

Programmatically created UIBarButtonItem Not Launching Selector Action

余生长醉 提交于 2019-12-21 09:38:15
问题 Here is my UIBarButton : [self.navigationItem setLeftBarButtonItem:[[UIBarButtonItem alloc] initWithTitle:@"+ Contact" style:UIBarButtonItemStylePlain target:nil action:@selector(showPicker:)] animated:YES]; Here is the code it's supposed to launch: - (void)showPicker:(id)sender { ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init]; picker.peoplePickerDelegate = self; [self presentModalViewController:picker animated:YES]; [picker release]; } When I

Programmatically created UIBarButtonItem Not Launching Selector Action

Deadly 提交于 2019-12-21 09:38:05
问题 Here is my UIBarButton : [self.navigationItem setLeftBarButtonItem:[[UIBarButtonItem alloc] initWithTitle:@"+ Contact" style:UIBarButtonItemStylePlain target:nil action:@selector(showPicker:)] animated:YES]; Here is the code it's supposed to launch: - (void)showPicker:(id)sender { ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init]; picker.peoplePickerDelegate = self; [self presentModalViewController:picker animated:YES]; [picker release]; } When I

Rotate UIBarButtonItem Swift

ε祈祈猫儿з 提交于 2019-12-21 05:29:08
问题 In Swift, I have a hamburger bar button, so when tapped I want that hamburger Bar button to rotate 90 degrees (so that the lines are vertical) and then when you click it again I would like it to go back to it's original state (horizontal) NOTE: Can you make sure that this works for a UIBarButtonItem, because some solution to a normal UIButton does not work. 回答1: I use a UIButton inside of UIBarButtonItem to achieve this, and a variable with state vertical or not this is my storyboard setup

iPad's UIActionSheet showing multiple times

那年仲夏 提交于 2019-12-21 03:56:10
问题 I have a method called -showMoreTools: which is: - (IBAction) showMoreTools:(id)sender { UIActionSheet *popupQuery = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:nil destructiveButtonTitle:@"Close" otherButtonTitles:@"Add Bookmark", @"Add to Home Screen", @"Print", @"Share", nil]; popupQuery.actionSheetStyle = UIActionSheetStyleDefault; popupQuery.dismiss [popupQuery showFromBarButtonItem:moreTools animated:YES]; [popupQuery release]; } When an user taps a

Add spacing between UIToolbar

柔情痞子 提交于 2019-12-21 03:19:19
问题 I have a toolbar that looks like the following: The issue is that it is kind of cluttered and therefore I would like to add some spacing to it. I tried doing: UIBarButtonItem *spacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]; self.toolbar_array = [[NSMutableArray alloc] initWithObjects:self.mention, spacer, self.picture, spacer, share, spacer, self.message, nil]; But it still gives me the same thing. How can I add a 10px

How to add UIBarButtonItem to NavigationBar while using UIPageViewController

北慕城南 提交于 2019-12-20 14:08:13
问题 Please forgive me, there are already a ton of questions on how to add a UIBarButtonItem to a NavigationBar programmatically but I just can't seem to get any of the solutions to work in my situation. Here is the layout of a simple test app I have been working with to learn the UIPageViewController. I have the page view controller working nicely with three unique viewControllers. I would now like to set unique rightBarButtonItems for each of the view controllers. I can easily set a common

How to add UIBarButtonItem to NavigationBar while using UIPageViewController

淺唱寂寞╮ 提交于 2019-12-20 14:07:22
问题 Please forgive me, there are already a ton of questions on how to add a UIBarButtonItem to a NavigationBar programmatically but I just can't seem to get any of the solutions to work in my situation. Here is the layout of a simple test app I have been working with to learn the UIPageViewController. I have the page view controller working nicely with three unique viewControllers. I would now like to set unique rightBarButtonItems for each of the view controllers. I can easily set a common

Persistent rightBarButtonItem Property of UINavigationItem

主宰稳场 提交于 2019-12-20 10:48:10
问题 This may be a stupid question, but is it possible to keep a right UIBarButtonItem across multiple views managed by a UINavigationController ? I have a progression of views that often share the same right UIBarButtonItem , but when I push a new view to my UINavigationController , I have to redefine the button every time, even if it hasn't changed. Mostly, the noticeable transitional animation from one view to the next is what bothers me because the exact same button briefly fades out then back