Question

I have made a method in appdelegate class which is-

@implementation UINavigationBar (category)
- (void)drawRect:(CGRect)rect{
       UIImage *img = [UIImage newImageFromResource:@"Img.png"];
       [img drawInRect:rect];
       [img release];
}
@end

I want to set the size(x,y,width,height) of the image(Img.png) programitcally in some other class..so how to call/use (- (void)drawRect:(CGRect)rect) method in some other class?

Was it helpful?

Solution

do like this

AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
[appDelegate drawRect:CGRectMake(x,y,width,height)];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top