开发者

init not being called on PDFPage subclass?

开发者 https://www.devze.com 2023-03-23 22:47 出处:网络
I have a custom PDFDocument class where I have subclassed - (Class)pageClass and return the Class method of my custom PDFPage.Then in my PDFPage class I have created an implementation for init like so

I have a custom PDFDocument class where I have subclassed - (Class)pageClass and return the Class method of my custom PDFPage. Then in my PDFPage class I have created an implementation for init like so:

开发者_运维技巧
- (id)init
{
    self = [super init];
    if (self) {
        NSLog(@"Custom PDFClass initiated");
    }

return self;
}

and it is not being called when I open a PDF document. I have checked the result of - (PDFPage *)pageAtIndex:(NSUInteger)index and it is returning an instance of my custom class. What am I doing wrong?


PDFPage objects are usually created with initWithDocument or initWithImage, if you would like to do something at initialization, you should probably override both.

0

精彩评论

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