how to call drawrect method from another class when it is made in appdelegate class
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 cal开发者_开发知识库l/use (- (void)drawRect:(CGRect)rect) method in some other class?
do like this
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
[appDelegate drawRect:CGRectMake(x,y,width,height)];
精彩评论