If you will decide to implement it as function it could be something like
void addNavigationButton(UIViewController *vc, UIImage *image, SEL action)
{
UIButton *butt2=[UIButton buttonWithType:UIButtonTypeCustom ];
[butt2 setFrame:CGRectMake(285, 7, 30, 25)];
[butt2 setTag:2];
[butt2 setImage:image forState:UIControlStateNormal];
[butt2 addTarget:vc action:action forControlEvents:UIControlEventTouchDown];
[vc.navigationController.navigationBar addSubview:butt2] ;
}
It should be called in your view controller
addNavigationButton(self, [UIImage imageNamed:@"tag_icon.png"], @selector(revealMenu:));
Another good idea - implement this function as a UIViewController's category method.