uibarbuttonitem

Swift: inputAccessoryView buttons are not showing

大兔子大兔子 提交于 2019-12-11 20:54:44
问题 Following is my code for adding an inputAccessoryView (with a Done button on it) to my textView: let keyboardButtonView = UIToolbar() keyboardButtonView.sizeToFit() let doneButton = UIBarButtonItem(image: nil, style: .Done, target: self, action: "closeMessageViewKeyboard") doneButton.possibleTitles = ["Done"] var toolbarButtons = NSMutableArray() toolbarButtons.addObject(doneButton) keyboardButtonView.items = toolbarButtons as [AnyObject] messageView.inputAccessoryView = keyboardButtonView

UIBarButtonItem color setting in Swift-5.0

时光总嘲笑我的痴心妄想 提交于 2019-12-11 18:03:46
问题 I realised that the color-behaviour of my UIBarButtonItem's (left and right buttons) is not as desired. If I press and hold the right UIBarButton (see video), then the color changes from light-yellow to gray'isch dark-yellow. However, I would like a solution that keeps the same light-yellow color, no matter of any button selection, press-and-hold, etc. The button color should always stay the same light-yellow. How can I achieve this ? Here is the video done in Simulator: (you can clearly see

iOS: Send multiple actions to a bar button

﹥>﹥吖頭↗ 提交于 2019-12-11 17:51:31
问题 In my app I'm looking to customise a bar button that currently shows the user's location so that if the user taps and holds down it shows a subview with some other info. However it seems I can only send one action. Is this definitely the case or is there a way I can have more than one action? I know there's a subclass to enable the user orientation position (like in the Maps app) - could I somehow implement similar functionality? 回答1: UIBarButtonItems only send one event. You'll need to

Problem over-riding the Back button in iOS

陌路散爱 提交于 2019-12-11 16:35:55
问题 I have a UITableViewController A that is pushing UITableViewController B onto the stack. In A i have the code: self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Trending" style:UIBarButtonItemStylePlain target:self action:@selector(backButtonClicked:)]; backButtonClicked: is also implemented. B has the title Trending, but when I click it, it doesn't ever reach backButtonClicked: Why is this? 回答1: Try either setting the delegate: [navigationController setDelegate

Custom Bar Button Item Image Frame Too Wide [closed]

∥☆過路亽.° 提交于 2019-12-11 16:13:28
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 months ago . I am trying to add a custom icon as the image of a bar button item. I correctly added the image assets in the 1x, 2x, 3x sizes, but the frame is too wide for no apparent reason. The image itself is a square and does not have such a wide frame. Click the link below to see the issue. Is there a way to fix this?

How to remove/avoid small white splash light on UIBarButtonItem programmatically

丶灬走出姿态 提交于 2019-12-11 15:34:18
问题 My issue is same as question: How to disable the the light that appears when touching a UIBarButtonItem? I have read answer if we use Interface builder. What if I add toolbar programmatically? How can I avoid the light on the bar button item? 回答1: To do what you want programatically you can do UIBarButtonItem *item; UIButton *b2=[[UIButton alloc] initWithFrame:frame]; [b2 addTarget:self action:@selector(settings:) forControlEvents:UIControlEventTouchUpInside]; //you can set the background

Change font size via UiBarButtonItem in UITextView, works just once

无人久伴 提交于 2019-12-11 15:28:15
问题 I have UiTextView where I want change font size (increase), here code -(void)biggerFont:(UIBarButtonItem *) item { CGFloat i = [UIFont systemFontSize]; textView.font = [UIFont fontWithName:@"Tahome" size:i]; i+=2; } But it works just once, if you push once and after that again - fon size won't change. Help me please 回答1: It's easy you are not saving the state of i persistently. Everytime you set i to the same value. After the method has been run through i is discarded cause it only exists in

BarButtonItem not showing up

匆匆过客 提交于 2019-12-11 14:49:59
问题 In an app Im making, Im trying to enable login/logout to twitter. I want it so that there is a barbuttonitem that either says login if there is no current user, or logout if there is one. I created two buttons on the storyboard, one for login and one for logout. In the viewDidLoad(), I have this code: self.navigationItem.rightBarButtonItem = nil self.navigationItem.rightBarButtonItem = nil if twitterUser.currentUser != nil { print("there is a current user") self.navigationItem

How to implement UIAlertcontroller as PopOver(with arrow direction up) in a UIBarbutton

一笑奈何 提交于 2019-12-11 14:24:22
问题 I know that this is old school question - but I did searched the web and found solutions to be deprecated. How would I implement a UIAlertcontroller as popOver(with arrow direction up) in a barButton . Here's the code: - (IBAction)eventSortingAction:(UIBarButtonItem *)sender { UIAlertController * view= [UIAlertController alertControllerWithTitle:@"My Title" message:@"Select you Choice" preferredStyle:UIAlertControllerStyleActionSheet]; UIAlertAction* ok = [UIAlertAction actionWithTitle:@"OK"

Embedding View Controller in Tab Bar Controller removes navigation items

这一生的挚爱 提交于 2019-12-11 14:21:12
问题 I have a View Controller which is already embedded in a Navigation Controller as such: The Table View Controller has a programatically added title and button which work fine: override func viewWillAppear(_ animated: Bool) { navigationItem.title = "The Harrovian" } override func viewDidLoad() { super.viewDidLoad() navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .refresh, target: self, action: #selector(refresh)) I wanted to embed the Table View Controller in a Tab View