Re: Voice Over Performance for Complex Custom View
Re: Voice Over Performance for Complex Custom View
- Subject: Re: Voice Over Performance for Complex Custom View
- From: Xiang Cao <email@hidden>
- Date: Wed, 16 Sep 2009 16:22:50 -0700
- Thread-topic: Voice Over Performance for Complex Custom View
I forgot to mention. I didn't generate all the children everytime on the
fly. They are allocated only when children attributes are asked for the
first time. Then the array is retained as a member variable for later use. I
did this to improve the performance, but it's still a little slow.
On 9/16/09 3:46 PM, "Mike Engber" <email@hidden> wrote:
>
> On Sep 16, 2009, at 2:53 PM, Xiang Cao wrote:
>
>> if([attribute isEqualToString:NSAccessibilityChildrenAttribute])
>> {
>> if(mChildren)
>> {
>> if(index+maxCount>[mChildren count]) maxCount =
>> [mChildren count] - index;
>> NSRange range = NSMakeRange(index, maxCount);
>> return NSAccessibilityUnignoredChildren([mChildren
>> subarrayWithRange:range]);
>> }else return nil;
>
> I don't think you should ever be returning nil for you children -
> return an empty array - [NSArray array]
>
>> }else return [super accessibilityArrayAttributeCount:attribute];
>>
>> But I saw errors from console said like: !!! Failed to find child 2
>> (index 2) for AX specifier: <NSWindow: 0x21eb1e90>{32}.
>
> I assume you have turned on: -NSAccessibilityDebugLogLevel 1
>
> I would guess this error means that isEqual (used by indexOfObject) is
> not finding the child? Are you generating your children on the fly?
> Are they some class that uses the default isEqual implementation
> (pointer equality) ?
>
> Note if this is the problem and you fix it by implementing isEqual,
> don't forget to implement hash too.
>
>> Should I use NSAccessibilityUnignoredChildren() for the sub array?
>
> Yes. It is essential if there are any ignored UI Elements in your
> hierarchy. If there aren't, it won't matter, but you should still do
> it as it's a good habit.
>
>
>> My accessibilityIndexOfChild, looks like the following. Because the
>> documentation said I should return the child index from the Parent.
>> So I assume I have to ask the receiver¹s parent for their child
>> index. I¹m not sure if that is correct.
>>
>> - (NSUInteger)accessibilityIndexOfChild:(id)child
>> {
>> DFW_Accessibility* dfwchild = (DFW_Accessibility*)child; //
>> this is my custom access object
>>
>> if(dfwchild->mParent && dfwchild->mParent->mChildren)
>> {
>> NSUInteger index = [dfwchild->mParent->mChildren
>> indexOfObject:child];
>> if(index == NSNotFound)
>> {
>> NSLog(@"NSNotFound");
>> return NSNotFound;
>> }else NSLog(@"child index %d", index);
>> return index;
>> }else
>> {
>> return NSNotFound;
>> }
>> }
>
> Seems OK.
>
> -ME
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Accessibility-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden