开发者

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)];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜