Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Method with +
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Method with +



>    BOOL    *par = [MyClass GetParametersList];
>
> // in the class MyClass
> + (BOOL*)GetParametersList
> {
>     BOOL    *parList = calloc(kTotTimeParam, sizeof(BOOL));
>     int        i;
>
>     for(i = 0; i < kTotTimeParam; i++){
>         parList[i] = (i >= kTimeGenPosX && i <= kTimeGenVolu);
>     }
>
>     return parList;
> }


Seems like this would be a more Cocoa-like approach:

+ (NSArray*) getParametersList
{
    NSMutableArray  *theList = [NSMutableArray arrayWithCapacity:
kTotTimeParam];

    int i;

    for (I = 0; I < kTotTimeParam; I++)
    {
        NSNumber    *parm = [NSNumber numberWithBool:(i >= kTimeGenPosX && i
<= kTimeGenVolu)];

        [theList addObject:parm];
    }

    return theList;
}



Eric


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Method with + (From: Lorenzo <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.