twitter rss

How can I put two buttons at the same in a navigation bar?

Labels:
yep,

Here is the problem:
I want to put these 2 buttons at the same site(right). The standard navigation bar in iphone doesnt allow me to do this, I mean, there is just one placeholder for the right button. So the solution which I took was doing a sort of hack component to fit 2 buttons, here is the code:



-(UIBarButtonItem *)makeRightBarButtonItem {
// create a toolbar to have two buttons in the right
TransparentToolbar* tools = [[TransparentToolbar alloc] initWithFrame:CGRectMake(0, 0, 90, 44.01)];
tools.tintColor = [UIColor clearColor];


// create the array to hold the buttons, which then gets added to the toolbar
NSMutableArray* buttons = [[NSMutableArray alloc] initWithCapacity:3];

// create a calendar button
UIBarButtonItem* toolBarItem = [[UIBarButtonItem alloc]
initWithImage:[UIImage imageNamed:@"calendarIcon.png"]
style:UIBarButtonItemStyleBordered
target:self
action:@selector(callCalendar:)
];

[buttons addObject:toolBarItem];
[toolBarItem release];

// create a spacer
toolBarItem = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
[buttons addObject:toolBarItem];
[toolBarItem release];

// create a standard "add" button
toolBarItem = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(callJournalEntry:)];
toolBarItem.style = UIBarButtonItemStyleBordered;
[buttons addObject:toolBarItem];
[toolBarItem release];

// stick the buttons in the toolbar
[tools setItems:buttons animated:NO];

[buttons release];

//the toolbar is our right bar button
UIBarButtonItem *theButton = [[[UIBarButtonItem alloc] initWithCustomView:tools] autorelease];
[tools release];

return theButton;
}
However, as you can see I`m not using a normal toolbar, I`m using a "TransparentToolbar" which I had to create as well, I just had to do it to make my navigation bar black, so here is the code for the toolbar:

TransparentToolbar.h


#import <Foundation/Foundation.h>


@interface TransparentToolbar : UIToolbar
@end

TransparentToolbar.m

#import "TransparentToolbar.h"


@implementation TransparentToolbar

// Override draw rect to avoid
// background coloring
- (void)drawRect:(CGRect)rect {
    // do nothing in here
}

// Set properties to make background
// translucent.
- (void) applyTranslucentBackground
{
    self.backgroundColor = [UIColor clearColor];
    self.opaque = NO;
    self.translucent = YES;
}

// Override init.
- (id) init
{
    self = [super init];
    [self applyTranslucentBackground];
    return self;
}

// Override initWithFrame.
- (id) initWithFrame:(CGRect) frame
{
    self = [super initWithFrame:frame];
    [self applyTranslucentBackground];
    return self;
}

@end
That`s it, now you have your bar with two buttons at the right site.

Ctrl + Shif + F for flex IDE

Labels:
Hi Everyone,
I just start doing some Flex POCs in Adobe Flex Builder 3, as Flex Builder is based in Eclipse RCP, and I`m used to eclipse, my first thought was that all the shortcuts that I know for Eclipse I will definitely still using in the Flex Builder IDE, however when I tried to format(indent) my action script file I realize that I didnt have this functionality in Flex Builder.  So  I found a plugin called Flex Formatter which I installed and got working this func! Awesome, let me share here what I did!

First, open the Software Update:





Then, add a new Remote Site and put this address:
http://flexformatter.googlecode.com/svn/trunk/FlexFormatter/FlexPrettyPrintCommandUpdateSite

After that fallow the steps to install the plugin.


To set up the shortcut(ctrl+shif+F) just go to Window>Preferences...>General>Key and type format like the screen bellow:

Just bind the short cut that you want, and done!

Obs.: I`m using MAC OS, so the shortcuts are differente!

Followers

Text Widget