Search Results

Search found 177 results on 8 pages for 'uibarbuttonitem'.

Page 1/8 | 1 2 3 4 5 6 7 8  | Next Page >

  • How to get the embeded button of UIBarButtonItem

    - by Jagie
    In an iPhone app,we can make a UIBarButtonItem by using the following code: UIBarButtonItem *bbix=[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:nil action:nil]; the generated UIBarButtonItem has a system-provided "action" icon.My question is :how to get this UIBarButtonItem's inner UIButton and add this UIButton to another UIView? who can show me some code? thanks in advance

    Read the article

  • UIBarButtonItem with custom image and no border

    - by mongeta
    Hello, I want to create a UIBarButtonItem with a custom image, but I don't want the border that iPhone adds, as my Image has a special border. It's the same as the back button but a forward button. This App is for an inHouse project, so I don't care if Apple reject or approves it or likes it :-) If I use the initWithCustomView:v property of the UIBarButtonItem, I can do it: UIImage *image = [UIImage imageNamed:@"right.png"]; UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; [button setBackgroundImage: [image stretchableImageWithLeftCapWidth:7.0 topCapHeight:0.0] forState:UIControlStateNormal]; [button setBackgroundImage: [[UIImage imageNamed: @"right_clicked.png"] stretchableImageWithLeftCapWidth:7.0 topCapHeight:0.0] forState:UIControlStateHighlighted]; button.frame= CGRectMake(0.0, 0.0, image.size.width, image.size.height); [button addTarget:self action:@selector(AcceptData) forControlEvents:UIControlEventTouchUpInside]; UIView *v=[[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, image.size.width, image.size.height) ]; [v addSubview:button]; UIBarButtonItem *forward = [[UIBarButtonItem alloc] initWithCustomView:v]; self.navigationItem.rightBarButtonItem= forward; [v release]; [image release]; This works, but if I have to repeat this process in 10 views, this is not DRY. I suppose I have to subclass, but what ? NSView ? UIBarButtonItem ? thanks, regards,

    Read the article

  • Sanity check: UIBarButtonItem crashes trying to perform action

    - by Giao
    One of my users is reporting a crash on his device, an iPhone 3GS. Other devices of the same type are not reporting similar behavior. He's sent me a crash log and based on reading it, I'm not sure how to proceed. I hope I'm not interpreting the crash log incorrectly but it doesn't look like my action has been called yet. This is how I'm creating and setting up the UIBarButtonItem: - (void)viewDidLoad { [super viewDidLoad]; UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(addLog:)]; self.navigationItem.rightBarButtonItem = addButton; [addButton release]; } This is the my action method: - (IBAction)addLog:(id)sender { MyViewController *myController = [[MyViewController alloc] initWithNibName:@"MyNib" bundle:nil]; UINavigationController *subNavigationController = [[UINavigationController alloc] initWithRootViewController: myController]; [self presentModalViewController:subNavigationController animated:YES]; [myController release]; [subNavigationController release]; } This is the crash log: Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x00000000, 0x00000000Crashed Thread: 0 Thread 0 Crashed: 0 libSystem.B.dylib 0x0007e98c __kill + 81 libSystem.B.dylib 0x0007e97c kill + 4 2 libSystem.B.dylib 0x0007e96e raise + 10 3 libSystem.B.dylib 0x0009361a abort + 34 4 MyApp 0x000042e8 0x1000 + 13032 5 CoreFoundation 0x00058ede -[NSObject performSelector:withObject:withObject:] + 18 6 UIKit 0x0004205e -[UIApplication sendAction:to:from:forEvent:] + 78 7 UIKit 0x00094d4e -[UIBarButtonItem(Internal) _sendAction:withEvent:] + 86 8 CoreFoundation 0x00058ede -[NSObject performSelector:withObject:withObject:] + 18 9 UIKit 0x0004205e -[UIApplication sendAction:to:from:forEvent:] + 78 10 UIKit 0x00041ffe -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 26 11 UIKit 0x00041fd0 -[UIControl sendAction:to:forEvent:] + 32 12 UIKit 0x00041d2a -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 350 13 UIKit 0x0004263e -[UIControl touchesEnded:withEvent:] + 330 14 UIKit 0x00041656 -[UIWindow _sendTouchesForEvent:] + 318 15 UIKit 0x00041032 -[UIWindow sendEvent:] + 74

    Read the article

  • Adding UIBarButtonItem to UINav..Controller

    - by mlecho
    i am not sure what i am missing here. I Have a custom UINavigationController and i am trying to add a persistant UIBarButtonItem to the bar. -(void)viewDidLoad { self.navigationBar.barStyle = UIBarStyleBlack; UIBarButtonItem *bbi = [[UIBarButtonItem alloc] initWithTitle:@"Nope..." style:UIBarButtonItemStyleBordered target:self action:@selector(goBack:)]; self.navigationItem.leftBarButtonItem =bbi; [bbi release]; } -(void)goBack:(id)sender { NSLog(@"go back now"); } what am i missing here? - BTW, i do not want to/ will not use IB.

    Read the article

  • Custom UIBarButtonItem with quartz

    - by burki
    Hi! How can I draw a button with quartz that has exactly the same style as a UIBarButtonItem. The button should be able to show different colors. I downloaded the Three20 project, but this project is really complex, you'd need a lot of time to overlook the whole framework. I just want to draw a custom UIBarButtonItem. Thanks for help.

    Read the article

  • Pressing UIBarButtonItem on a NavigationController

    - by john
    Hey I've added a button the my navigation bar like so: UIBarButtonItem *anotherButton = [[UIBarButtonItem alloc] initWithTitle:@"Edit" style:UIBarButtonItemStylePlain target:self action:@selector(methodtocall:)]; self.navigationItem.rightBarButtonItem = anotherButton; [anotherButton release]; However when I press this I get a InvalidArgumentException. This is in a brand new navigation project. Does anyone know why I get this behaviour?

    Read the article

  • Change (not init) a UIBarButtonItem identifier programatically?

    - by Nebs
    In IB I can set the identifier of a UIBarButtonItem to 'play' which adds an image of a play button (right-pointing triangle). Is there a way to change this image programatically? I want to change it to 'pause' when the play button is pressed. I know you can initialize a UIBarButtonItem with an identifier but I've yet to find a way to change it after it's been initialized. Is this even possible? The only thing I can think of is to remove the old button and initialize a new one in its place, but this hardly seems efficient. Any thoughts?

    Read the article

  • How to change UIBarButtonItem Title - iPhone SDK

    - by user340226
    Hi Can anyone help me in that I am only trying to change the Title on an UIBarButtonItem from a different class. My code is: -(IBAction)spanishPush { SafetyTalks *bbiTitle= [[SafetyTalks alloc]init]; bbiTitle.bbiOpenPopOver.title = @"Spanish"; } SafetyTalks = the class I am trying to reference bbiOpenPopOver = the UIBarButtonItem. I can change the Title when in the SafetyTalks class by simple: bbiOpenPopOver.title = @"Talk Topics"; but cannot do it when I am out of that class. Please help. Andy

    Read the article

  • Enable UIBarButtonItem if multiple UITextFields are all populated

    - by CrystalSkull
    I have 3 UITextFields in a grouped UITableView and am trying to figure out the correct logic to only have my 'Save' UIBarButtonItem enabled when none of the UITextFields are empty. I'm currently using the - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string UITextField delegate method to detect changes to the field character by character, but it is providing inconsistent results. Any ideas?

    Read the article

  • iPhone SDK: Add UIBarButtonItem action programmaticly

    - by TutorialPoint
    Hello, I have several UIBarButtonItems, and I want to set the action when you press it programmaticly. How can I do this? Please give in-depth instructions since i just started to work with the SDK. EDIT: if it would be possible non-programmaticly, please also reply :) The action is going to Google.com, and the button is the search button in this project: (download): click here

    Read the article

  • How can you add a UIGestureRecognizer to a UIBarButtonItem as in the common undo/redo UIPopoverContr

    - by SG
    Problem In my iPad app, I cannot attach a popover to a button bar item only after press-and-hold events. But this seems to be standard for undo/redo. How do other apps do this? Background I have an undo button (UIBarButtonSystemItemUndo) in the toolbar of my UIKit (iPad) app. When I press the undo button, it fires it's action which is undo:, and that executes correctly. However, the "standard UE convention" for undo/redo on iPad is that pressing undo executes an undo but pressing and holding the button reveals a popover controller where the user selected either "undo" or "redo" until the controller is dismissed. The normal way to attach a popover controller is with presentPopoverFromBarButtonItem:, and I can configure this easily enough. To get this to show only after press-and-hold we have to set a view to respond to "long press" gesture events as in this snippet: UILongPressGestureRecognizer *longPressOnUndoGesture = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPressOnUndoGesture:)]; //Broken because there is no customView in a UIBarButtonSystemItemUndo item [self.undoButtonItem.customView addGestureRecognizer:longPressOnUndoGesture]; [longPressOnUndoGesture release]; With this, after a press-and-hold on the view the method handleLongPressOnUndoGesture: will get called, and within this method I will configure and display the popover for undo/redo. So far, so good. The problem with this is that there is no view to attach to. self.undoButtonItem is a UIButtonBarItem, not a view. Possible solutions 1) [The ideal] Attach the gesture recognizer to the button bar item. It is possible to attach a gesture recognizer to a view, but UIButtonBarItem is not a view. It does have a property for .customView, but that property is nil when the buttonbaritem is a standard system type (in this case it is). 2) Use another view. I could use the UIToolbar but that would require some weird hit-testing and be an all around hack, if even possible in the first place. There is no other alternative view to use that I can think of. 3) Use the customView property. Standard types like UIBarButtonSystemItemUndo have no customView (it is nil). Setting the customView will erase the standard contents which it needs to have. This would amount to re-implementing all the look and function of UIBarButtonSystemItemUndo, again if even possible to do. Question How can I attach a gesture recognizer to this "button"? More specifically, how can I implement the standard press-and-hold-to-show-redo-popover in an iPad app? Ideas? Thank you very much, especially if someone actually has this working in their app (I'm thinking of you, omni) and wants to share...

    Read the article

  • How do I make a UIBarButtonItem 'glow'?

    - by brianegge
    In the Maps app, when you press the tracking button in the lower left hand corner, it glows showing that it's pressed. This makes it behave like a radio button, and it will un-glow once you move the map. Is there a simple way to but a button into the pressed state?

    Read the article

  • UIToolbar UIBarButtonItem Alignment question

    - by Luther Baker
    I need to create a UIToolbar that has two UIBarButtonItems. The 1st button must be centered and the 2nd item must be right aligned. I understand and use Flexible spacing and it works great when I need to balance buttons across the UIToolbar, but with only two buttons, I can't seem to perfectly center the middle button. I've even initialized the view.toolbarItems array with NSArray *items = [[NSArray alloc] initWithObjects:fixed, flex, center_button, flex, right_button, nil]; and set fixed.width = right_button.width ... but still, the center_button is never perfectly centered.

    Read the article

  • Animate the enabling of a UIBarButtonItem?

    - by Michael Brewer
    Is there a way to animate enabling or disabling a button? I've tried the following with no success. I'm guessing at this point that the enabled property cannot be animated like opacity can – but I hope I'm wrong. [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:1.0f]; theButton.enabled = YES; [UIView setAnimationDelegate:self]; [UIView commitAnimations]; I can't believe there isn't a setEnabled:(BOOL)enabled animated:(BOOL)animated method.

    Read the article

  • Mvc Cocoa: How to get controller object for UIBarButtonItem target in view?

    - by plehoux
    I got a basic application where I want the action method of UIBarButtonItem to be in the parent controller. My view has been created programmatically, so I can't use IBAction. RootViewController - NavigationViewController - NavigationView - UIBarButtonItem Here's how have done it for the moment, it works for now... but it's not a really scalable technic (in NavigationView.m): BookAppDelegate *delegate = [[UIApplication sharedApplication] delegate]; UIBarButtonItem *soundEffects = [[UIBarButtonItem alloc] initWithTitle:@"Sound Effects" style:UIBarButtonItemStyleBordered target:[delegate.rootViewController navigationViewController] action:@selector(soundEffectsClicked:)]; What would be a better technic to get the NavigationViewController object?

    Read the article

  • how to balance position of UIBarButtonItem in toolbar

    - by RAGOpoR
    is it possible to balance the position of button(example toolbar in Safari)? UIBarButtonItem *infoButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCompose target:self action:@selector(support:)]; UIBarButtonItem *next = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemPlay target:self action:@selector(support:)]; [self.navigationController.toolbar setItems:[NSArray arrayWithObjects:infoButton, next,nil] animated:YES];

    Read the article

  • How do you adjust the frame or vertical alignment of a UIBarButtonItem contained by a UIToolbar inst

    - by akaii
    Horizontal positioning of UIBarButtonItems is no problem, I can simply pad the space with fixed/flexible space items. However, I can't seem to adjust the toolbar item vertically. UIToolbar has no alignment property, and UIBarButtonItem has no way of setting its frame. I need to do this because we're using a mix of custom icons created using initWithImage, and standard icons created with initWithBarButtonSystemItem. The custom icons aren't being centered properly (they're offset upwards, relative to the system icons, which are centered properly), so the toolbar looks awkward.

    Read the article

  • How to fire the action of a uibarbuttonitem programatically?

    - by Aruna Herath
    I have created an uibarbuttonitem dynamically and it works properly. I want to fire that uibarbutton item action(click) programatically for unit testing. Even though the code work properly when I log the action of the bar button item in the application code (not on testing code) it gives null. The code I have used is given below. NSLog(@"%@",NSStringFromSelector(barButton.action)); In the testing code I have created a bar button called logout and assign barbutton to that.To click the bar button item programatically I followed the following code. [logout.target performSelector:logout.action]; But it didn't work . I logged the action of logout button and it also gives null. NSLog(@"%@",logout.action); I want to know how to programatically click a uibarbutton item which created dynamically .

    Read the article

  • How to change image and disable UIBarButtonItem

    - by Alex
    I have a NavigationBar app with two views: a parent and a sub view. In the sub view I'm adding a button to the right corner as follows: - (void)viewDidLoad { UIBarButtonItem *tempButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"lock-unlocked.png"] style:UIBarButtonItemStylePlain target:self action:@selector(lockScreen)]; self.navigationItem.rightBarButtonItem = tempButton; [tempButton release]; } When that button is clicked I want to change the image of this rightBarButtonItem and disable the leftBarButtonItem (which was added automatically by the controller). Basically have two states of a button, locked and unlocked. Question 1: The only way I can find how to change the image is to create a new UIButtonItem with a new image and replace rightBarButtonItem with that new one. But I'm wondering if there's a way to just change the image without creating a new UIBarButtonItem. Am I creating a memory leak if I keep creating new UIBarButtonItem? Question 2: How can I get a hold of self.navigationItem.leftBarButtonItem and disable/enable it? I don't create that one manually, it's created automatically for me by the controller. I don't see any method/property on UIBarButtonItem to enable/disable user interaction with it.

    Read the article

  • display original image color with UIBarButtonItem

    - by user262325
    I used codes below to display a image on an UIBarButtonItem UIBarButtonItem *myButtonItem; myButtonItem= [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"image.png"] style:UIBarButtonItemStylePlain target:self action:@selector(pressB:)]; but the image color is two colors(red/blue), but the image displayed on the ButtonItem is white. Iy looks like IOS change it to white color automatically. Welcome any comment

    Read the article

  • How can I make the text of a UIBarButtonItem wrap to two lines?

    - by bio18
    Some of the titles of view controllers in my UINavigationController are quite long, which makes the back button in the navigation bar of the next view controller in the hierarchy miss out some of the text, with a "..." instead. How could I make the text of the back button wrap onto two lines, as with "Now Playing" in the navigation bar of iPod.app? Thanks!

    Read the article

1 2 3 4 5 6 7 8  | Next Page >