uibarbuttonitem

programmatically highlight UIBarButtonItem

时光总嘲笑我的痴心妄想 提交于 2019-12-28 05:59:02
问题 after tapping the 'record' BarButtonItem I would like to keep it programmatically highlighted until the recording is over. The highlighting graphics of iOS are very good, therefor I would like to remain or set that state. Up to now I found 'setSelected' and 'setHighlighted' but these do not work on a UIBarButtonItem. Any suggestions on how to solve this? Thank you in advance, Koen. 回答1: setSelected and setHighlighted work fine on UIControls, but not UIBarButtonItems (which are not UIControls)

Change width of a UIBarButtonItem in a UINavigationBar

只愿长相守 提交于 2019-12-28 04:01:09
问题 I am creating a UIBarButtonItem and adding it to my navigation bar like so: (void)viewDidLoad { ... // Add the refresh button to the navigation bar UIButton *refreshButton = [UIButton buttonWithType:UIButtonTypeCustom]; [refreshButton setFrame:CGRectMake(0,0,30,30)]; [refreshButton setImage:[UIImage imageNamed:@"G_refresh_icon.png"] forState:UIControlStateNormal]; [refreshButton addTarget:self action:@selector(refreshData) forControlEvents:UIControlEventTouchUpInside]; UIBarButtonItem

Increase NavigationBar height

落爺英雄遲暮 提交于 2019-12-28 03:10:11
问题 I have the following code: func navbarbutton() { UIView.animateWithDuration(0.2, animations: { () -> Void in let current = self.navigationController?.navigationBar.frame self.navigationController?.navigationBar.frame = CGRectMake(self.frame!.origin.x, self.frame!.origin.y, self.frame!.size.width, current!.size.height + 50) self.navigationController?.navigationBar.layoutIfNeeded() }) } I'm able to increase the height of the navigation bar by 50 dp. That's not the issue for me. The issue I'm

in Swift4, replacement of navigationItem.leftBarButtonItem resizes unwanted

旧巷老猫 提交于 2019-12-25 12:43:40
问题 Having a problem with UIBarButtonItem resizing when returning to VC with different values for frame and image. var selectedR = 1 var leftFrame = CGRect() var leftImage = UIImage() override func viewDidLoad() { super.viewDidLoad() if selectedR == 0 { leftFrame = CGRect(x: 0, y: 0, width: 33, height: 33) leftImage = UIImage(named: “pic-0”)! } else if selectedR == 1 { leftFrame = CGRect(x: 0, y: 0, width: 79, height: 33) leftImage = UIImage(named: "pic-1")! } else if selectedR == 2 { leftFrame =

UIBarButtonItem not reacting after click

家住魔仙堡 提交于 2019-12-25 10:04:04
问题 From the rootViewController I navigate to a UIViewController if (self.contr == nil) { ExampleViewController *controller = [[ExampleViewController alloc] initWithNibName:@"Example" bundle:[NSBundle mainBundle]]; self.contr = controller; [controller release]; } [self.navigationController presentModalViewController:self.contr animated:YES]; In the UIViewController I have the method -(IBAction) goBack:(id)sender { [self.navigationController dismissModalViewControllerAnimated:YES]; } I added the

UIBarButtonItem not reacting after click

前提是你 提交于 2019-12-25 10:03:33
问题 From the rootViewController I navigate to a UIViewController if (self.contr == nil) { ExampleViewController *controller = [[ExampleViewController alloc] initWithNibName:@"Example" bundle:[NSBundle mainBundle]]; self.contr = controller; [controller release]; } [self.navigationController presentModalViewController:self.contr animated:YES]; In the UIViewController I have the method -(IBAction) goBack:(id)sender { [self.navigationController dismissModalViewControllerAnimated:YES]; } I added the

Does changing a button's title prevent further action?

被刻印的时光 ゝ 提交于 2019-12-25 07:47:25
问题 I have a bar button, let's call it button 1, which when clicked, programatically segues to a different page. However, after clicking another button (button 2), button 1's title is changed. From then on, button 1 no longer responds regardless of whether it's title has been changed back by clicking button 2 again. I hope you understand, if not - I can clarify code: (button 2 is edit) - (1 is info/add) -(void)editButton:(id)sender { [self setEditing:(![self isEditing])]; self.navigationItem

Enabling a button using data from Parse.com - Swift

不羁的心 提交于 2019-12-25 04:50:11
问题 I am trying to enable a bar button if the user is labeled "Yes" in the SubscribedUser key. I really do not know how to do this. I have used queries before but only to call objects onto the screen, nothing like this before. Here is what I have right now, I know it is wrong but I hope you get the idea of what I'm trying to do right now: func enableButton() { var query: PFQuery = PFQuery(className: "User") query.whereKey("username", equalTo: PFUser.currentUser().username) if query.valueForKey(

Button Questions in MonoTouch

丶灬走出姿态 提交于 2019-12-25 02:13:57
问题 I'm working with MonoTouch and I have come up with three questions around buttons that I'm hoping someone can help me with. I'm trying to change the "Back" button in the title bar. How do I do this? I've seen the thread posted here: How to change text on a back button. However, that doesn't work. I get the vibe that I'm not accessing the controller property. Currently, I receive a NullReferenceException when I attempt to set the button text in the ViewDidLoad method. Currently, I'm trying to

UIBarButtonItem Long Press / Short Press

删除回忆录丶 提交于 2019-12-25 00:51:42
问题 I have looked through the existing questions on this subject matter, and there appears to be no answers post iOS 11 (which appeared to break the gesturerecognizers). Is there a way to detect the short press / long press on a UIBarButtonItem? Apple uses this functionality in Pages, Numbers, Keynote for Undo / Redo. 回答1: Try this @IBOutlet weak var btn: UIButton! override func viewDidLoad() { let tapGesture = UITapGestureRecognizer(target: self, #selector (tap)) //Tap function will call when