UIBarButtonItem image with the "creation" button - iphone

I'm new to the iPhone SDK and I wonder, where I get some standard buttons, that a lot of applications use. I wanted to have that button:
http://4.bp.blogspot.com/_fAv06gZ6FPU/SumCCleuwpI/AAAAAAAAAFs/0mtPapm8EFg/s1600-h/Screen+shot+2009-10-29+at+11.47.20.png
in an UIToolbar. Any advices please? :-)
Thanks in advance...

[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCompose target:myTarget action:mySelector];

Related

Modifying MWPhotoBrowser in iPhone

Hi I am have added the MWPhotoBrowser in my iPhone application it works great but now i need to add a little more functionality to my photo gallery.
basically what to do a couple things:
add a button to the navigation bar
decrease the space between two images.
However I don't know how to approach this problem.. should I subclass the Photo Browser or should I make changes in the Photo Browser's source code.
P.S. i tried to modify the code directly in MWPhotoBrowser.h file which didn't work. No changes were made. I'm super new to iPhone programming so i don't have much idea what is going on. Any help would be greatly appreciated. I know its a noobish question so please go easy on down votes :)
In the MWPhotoBrowser.m file find the setNavBarAppearance method and add this
UIBarButtonItem *rightButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd
target:self action:#selector(someAction)]; // This can be changed to your liking
self.navigationItem.rightBarButtonItem = rightButton;
[rightButton release];
Set the Padding : 10 to 0;
Its done.
Thnaks

specially indicating or highlighting a toolbar button when a note is added in iphone

In my app i have an option for adding notes to particular tips.the button for adding notes is at the top.So i want to highlight that particular button when a notes is added.If a Tip has a note attached the notes icon should light up / glow (somehow look different), so that it can quickly identify this tip has a note attached.How can i implement this one.Is it possible.Can any one Please help me.Thanks in advance
We used some special button in tool bar in an application. We make it following way.
UIButton* btnInfo = [UIButton buttonWithType:UIButtonTypeInfoLight];
[btnInfo addTarget:self action:#selector(verInfoBtnClicked:) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *modalButton = [[UIBarButtonItem alloc] initWithCustomView:btnInfo];
Here main point is to use [[UIBarButtonItem alloc] initWithCustomView:btnInfo]; method.
Check if it can be helpful...

iPhone/iPad: how to change location of home or cancel or any buttons in UINavigationController (with or without InterfaceBuilder)

My question is fairly straightforward and simple.
I have seen code that implements a button (such as a cancel button) that can be added to a UINavigationController. Code looks like this:
UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc]
initWithImage: [UIImage imageNamed:#"home.png"]
style: UIBarButtonItemStylePlain target: self
action: #selector(cancel:)];
self.navigationItem.rightBarButtonItem = cancelButton;
[cancelButton release];
What I'd like to do is to place these buttons in a custom location in the navigationItem...not in the default rightBarButtonItem or leftBarButtonItem location, but controllable perhaps using x and y co-ordinates...is this even possible? It seems like a simple request, but google searching and documentation reviewing is driving me a little nuts :)
I would appreciate any assistance with this issue.
thanks again,
Edward
I agree with 'Hack Saw' in the case of it being against the Apple 'Human Interface Guide' and thus not recommended...However... If you want to, you can draw additional views into the navigation bar's title view [self.navigationContoller.navigationBar.topItem setTitleView]. Hope that helps!
Here is link to reference: UINavigationItem
They don't make that easy because it would break user expectation. I recommend against it. If you have a serious need for it, you'll probably need to make your own navbar.

Is it possible to change UIBarButtonItem title and style in runtime?

In one project, I hope to change UIBarButtonItem and style in runtime
editBarItemButton links to a UIBarButtonItem which original status are
style:UIBarButtonItemStyleBordered
title:Edit
if I press the bar item button, it will execute the codes below:
[editBarItemButton setStyle: UIBarButtonItemStyleDone];
[editTarBarItemButton setTitle:#"Done" ];
but neither the style nor title has changed.
Welcome any comment
Thanks
interdev
You cannot change the style of a UIBarButtonItem after it has already been initialized.
Old thread, but I am successful in changing the title for a UIBarButton item in a Navigation controller using the following:
[[[self navigationItem] rightBarButtonItem] setTitle:#"List"];
Just remove the old buttons
Create new buttons with the styles you want
Set the new buttons
What you want to do is something like this (that preserves localization for you app as well):
- (void)setBarButtonTo:(int)type
{
UIBarButtonItem *add = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:type target:self action:nil];
[self.navigationItem setRightBarButtonItem:add];
}
Where type is one of the system supplied, as UIBarButtonSystemItemDone or UIBarButtonSystemItemEdit. Hope this helps. :)
PS: I'm aware it's an old question, but it lacked a proper answer.

iPhone app Action Button

I need to add an action button in my iPhone application. When that one is clicked the UIActionSheet with buttons need to be popped up.
Can any one tell me how to add an action button? - means is there any in built action button for iPhone app? or do we need to create a new button with image?
Thanks in advance!
Assuming this is in a view controller, you can do something like:
- (void)viewDidLoad
{
UIBarButtonItem *actionButton = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemAction
target:self
action:#selector(methodThatShowsSheet)];
self.navigationItem.rightBarButtonItem = actionButton;
[actionButton release];
}
(Pardon the weird indentation to make it fit in a reasonable width (I normally just let Xcode wrap-indent everything automatically)).
See Nick Veys' answer for how to implement methodThatShowsSheet.
You need to hook up the action from the button you've decided will present this action sheet to code that shows it.
See the Apple Documentation on UIActionSheet for help on doing that.
I'm not sure I understnd your question but UIKit includes the UIButton class which will automatically send a message (specified by you) to an object (also specified by you). You can create a UIButton i nInterface builder or programatically.
Without more details on whay you actually want to do or why you're finding it difficult,m it's difficult to be more precise.