views:

42

answers:

1

Hi all,

I am facing a strange problem with CTFrameGetLines( frameRef ) method of Core Text API. I am getting an array of all CTLines that are present in a frame using function

CFArrayRef lines =   CTFrameGetLines( frameRef );

and then I am calculating no. of lines that are present using

    linesCount = CFArrayGetCount (lines);

In my case linesCount is coming to be 28. But when I try get line at index 17 in lines array using

line = (CTLineRef) [(NSArray *)lines objectAtIndex:i];

I am getting line as nil. I am not able to figure out when value of linesCount is coming to be 28 , then how come the value at 17th index in lines array be nil.There's need to be some line present at index 17.

Kindly help me in resolving this issue, this is really very urgent.

Thanx in advance, Regards, tek3

+1  A: 

objectAtIndex: should never return nil unless the receiver is nil. That would mean 'lines' is NULL. Maybe the call to CTFrameGetLines is failing. That doesn't explain why CFArrayGetCount would return 28 though. Does it return 28 every time? What does CFArrayGetValueAtIndex return?

Andrew

Andrew