Please any one can give an idea for an image adding repeatedly in X axis. Thanks in advance
Asked
Active
Viewed 125 times
-2
-
hi use category files to add the image.... – Arun Sep 18 '12 at 11:04
-
Elaborate what you are trying to do – Ranjit Sep 18 '12 at 11:27
-
i have a small jpg image and that added repeatedly for toolbar backgroud – iPC Sep 18 '12 at 11:32
-
i will add a small image that add to repeatedly in toolbar backgroud – iPC Sep 19 '12 at 07:15
1 Answers
0
hi here is the code to add image to the UIToolBar by category....
.h file :
#import <UIKit/UIKit.h>
@interface UIToolbar (AddtitionalFuntionality)
+(void)setToolbarBack:(NSString*)bgFilename toolbar:(UIToolbar*)toolbar;
@end
.m file:
#import "UIToolbar+AddtitionalFuntionality.h"
@implementation UIToolbar (AddtitionalFuntionality)
+(void)setToolbarBack:(NSString*)bgFilename toolbar:(UIToolbar*)bottombar {
// Add Custom Toolbar
UIImageView *iv = [[UIImageView alloc] initWithImage:[UIImage imageNamed:bgFilename]];
iv.frame = CGRectMake(0, 0, bottombar.frame.size.width, bottombar.frame.size.height);
iv.autoresizingMask = UIViewAutoresizingFlexibleWidth;
// Add the tab bar controller's view to the window and display.
if([[[UIDevice currentDevice] systemVersion] intValue] >= 5)
[bottombar insertSubview:iv atIndex:1]; // iOS5 atIndex:1
else
[bottombar insertSubview:iv atIndex:0]; // iOS4 atIndex:0
bottombar.backgroundColor = [UIColor clearColor];
}
@end
The call statement will be....
[UIToolbar setToolbarBack:@"tool-bar.png" toolbar:toolBarTop];
the source code of the category Here
link to blog: Site

Jody Hagins
- 27,943
- 6
- 58
- 87

Arun
- 3,406
- 4
- 30
- 55