Re: Two right buttons on UINavigationBar?

2009-08-12 Thread Steven Arnold

On Thu, 6 Aug 2009 14:03:12 -0400, Hank Heijink wrote:
If one of your buttons is always hidden, why do you need two  
buttons? You can just use one button and change the title, target,  
and action when you need to. If necessary you can even replace the  
whole button.


On Aug 6, 2009, at 1:47 AM, Agha Khan wrote:

Hi:
I have a UINavigationBar where I would like to place 2 buttons.


I have a use case for needing two buttons.  I need a button to add a  
new item and a button to edit (including delete and move around)  
existing items.  It's a UINavigationBar, so I am using the  
backBarButtonItem to traverse backward up the hierarchy.  On the right- 
hand side, I'd like to have two buttons next to one another, one with  
a UIBarButtonSystemItemEdit icon and the other with a  
UIBarButtonSystemItemAdd icon.


The closest I have come was trying to use a custom UIView:

UIButton *editButton = [[UIButton alloc]
initWithFrame:CGRectMake(0,0,100,75)];
editButton.titleLabel.text = @Edit;
UIButton *backButton = [[UIButton alloc]
initWithFrame:CGRectMake(100,0,100,75)];
backButton.titleLabel.text = @Back;

UIView *backAndEditButtons = [[UIView alloc] init];
// Add two buttons to view
[backAndEditButtons addSubview:backButton];
[backAndEditButtons addSubview:editButton];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]
initWithCustomView:backAndEditButtons];

This doesn't work: I see nothing at all on the right-hand side of the  
UINavigationBar.


I am new at manipulating UIViews, so any corrections to the code above  
are welcome.  Also if anyone feels I should try an entirely different  
approach to solving the problem, I'm interested.


steven

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Two right buttons on UINavigationBar?

2009-08-12 Thread Kyle Sluder
On Aug 12, 2009, at 11:49 AM, Steven Arnold stev...@arnold- 
software.com wrote:


I have a use case for needing two buttons.  I need a button to add a  
new item and a button to edit (including delete and move around)  
existing items.  It's a UINavigationBar, so I am using the  
backBarButtonItem to traverse backward up the hierarchy.  On the  
right-hand side, I'd like to have two buttons next to one another,  
one with a UIBarButtonSystemItemEdit icon and the other with a  
UIBarButtonSystemItemAdd icon.


The convention seems to be for the Add item to be on the bottom. Or  
you could expose it when Edit mode is active. You'll find plenty of  
examples of both (Mail and Contacts come to mind).


--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Two right buttons on UINavigationBar?

2009-08-07 Thread Agha Khan


It looks like it is a bug.
Someone else have same problem.

http://blog.7touchgroup.com/2009/08/uinavigationitem-sethidesbackbuttonyes-won 
’t-prevent-from-goingback/




I would like to change the action of the Done button.

As you see in UINavigationBar.h (line 62)
it has only 2 items (topItem and backItem). They have readonly flag.
I can't touch them.

UIBarButtonItem *buttonItem = [[UIBarButtonItem alloc]  
initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self  
action:@selector(toggleHelpGame)];
			UINavigationItem *navigationItem = [[UINavigationItem alloc]  
initWithTitle:@Help];

navigationItem.rightBarButtonItem = buttonItem;
[navigationItem setLeftBarButtonItem:nil];
			[self.sideNavigationBarCtrl pushNavigationItem:navigationItem  
animated:NO];

[navigationItem release];
[buttonItem release];

It works fine, but show previous Button as well. I was unable to get  
rid of that button.


In a reality we created a new UIBarButtonItem inside bar control, but  
never changed the previous attribute of Done button.


I have a work around to create another bar and hide the previous bar.

Any help will be very much appreciated.

Best regards
Agha



 ___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Two right buttons on UINavigationBar?

2009-08-06 Thread Arie Pieter Cammeraat

you might:

* change the buttons programmatically every time.

* drag 2 UIBarButtonItems in your InterfaceBuilder file, set the  
connections and the captions in IB. Then in XCode, you can change the  
buttons by using


NSArray * topLevelObjs = nil;
topLevelObjs = [[NSbundle mainBndle] loadNibName@yourNibFile  
owner:nameOfNIBFilesOwner options: nil];
UIBarButtonItem * barButton1 = (UIBarButtonItem *)[topLevelObjs  
objectAtIndex: indexNumber];


you could build in some error checking, like checking the class and  
the tag of the UIBarButtonItem.


Feel free to comment on this!

Op 6-aug-2009, om 7:47 heeft Agha Khan het volgende geschreven:


Hi:
I have a UINavigationBar where I would like to place 2 buttons. I  
was looking UINavigationBar.h for its implementation and didn't see  
the way we could add more than 2 buttons(Right hand side and left  
hand siderightBarButtonItem ) but my both buttons are  
rightBarButtonsItems where one of them is always hidden. I need 2  
buttons because they point to 2 different click functions and  
different captions.



You might have better idea?

Best regards
Agha___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/cocoa-dev% 
40yaranga.nl


This email sent to cocoa-...@yaranga.nl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Two right buttons on UINavigationBar?

2009-08-06 Thread Hank Heijink (Mailinglists)
If one of your buttons is always hidden, why do you need two buttons?  
You can just use one button and change the title, target, and action  
when you need to. If necessary you can even replace the whole button.


Hank

On Aug 6, 2009, at 1:47 AM, Agha Khan wrote:


Hi:
I have a UINavigationBar where I would like to place 2 buttons. I  
was looking UINavigationBar.h for its implementation and didn't see  
the way we could add more than 2 buttons(Right hand side and left  
hand siderightBarButtonItem ) but my both buttons are  
rightBarButtonsItems where one of them is always hidden. I need 2  
buttons because they point to 2 different click functions and  
different captions.



You might have better idea?

Best regards
Agha___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/hank.list 
%40runbox.com


This email sent to hank.l...@runbox.com



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Two right buttons on UINavigationBar?

2009-08-05 Thread Agha Khan

Hi:
I have a UINavigationBar where I would like to place 2 buttons. I was  
looking UINavigationBar.h for its implementation and didn't see the  
way we could add more than 2 buttons(Right hand side and left hand  
siderightBarButtonItem ) but my both buttons are rightBarButtonsItems  
where one of them is always hidden. I need 2 buttons because they  
point to 2 different click functions and different captions.



You might have better idea?

Best regards
Agha 
___


Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com