开发者

how to call drawrect method from another class when it is made in appdelegate class

开发者 https://www.devze.com 2023-04-12 20:03 出处:网络
I have made a method in appdelegate class which is- @implementation UINavigationBar (category) - (void)drawRect:(CGRect)rect{

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

精彩评论

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

关注公众号