Hi all!
I've got a small question concerning an import of a snippet.
In my app I want to use a custom backButton.
The code I use is the following:
Code:
UIImage *backImage = [UIImage imageNamed:@"backbutton.png"];
UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom];
backButton.frame = CGRectMake(0, 0, backImage.size.width, backImage.size.height);
[backButton setImage:backImage forState:UIControlStateNormal];
[backButton addTarget:self action:@selector(pushBackButton:) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *backBarButtonItem = [[[UIBarButtonItem alloc] initWithCustomView:backButton] autorelease];
self.navigationItem.hidesBackButton = YES;
self.navigationItem.leftBarButtonItem = backBarButtonItem;
It does work when it for example is in the viewDidLoad-Method.
Now I have several views where I do have to use the custom button.
I could copy the code to each view, but I'm sure this would be the poorest solution. How do I import code like this to each file?
Thank you very much in advance
Greetings
signsi