space
space

Reputation: 93

Objective C, how can call function in function?

I have a function is that

(NSArray *) getRGBsFromImage:(UIImage *)image atX:(int)xx andY:(int)yy count:(int) count {
   NSMutableArray *result;
   NSUInteger width=...;
   NSUInteger height=...;
   //algorithm
   return result;
}

I'm implementing a function that

(NSArray *) convertRGBAsForBW: (NSArray *) grayscaleArray
{
// as input i have to access grayscale array..but this array gives me rgbvalues in an NSArray and also I have to implement image.size, height, width...

}

How can I implement it, calling function in function? and how can I access Image's size,height,width ??

Upvotes: 0

Views: 857

Answers (2)

David
David

Reputation: 14404

If they are in the same class you can do something like this.

-(NSArray *) getRGBsFromImage:(UIImage *)image atX:(int)xx andY:(int)yy count:(int) count 
{
    //...
}   


- (NSArray *) convertRGBAsForBW: (NSArray *) grayscaleArray
{
    NSMutableArray *someArray = [NSMutableArray array];

    for (UIImage *image in grayscaleArray)
    {
        [someArray addObject:[self getRGBsFromImage:image atX:image.frame.origin.x andY:image.frame.origin.y count:[grayscaleArray count]]];
    }

    return someArray;
}

Upvotes: 2

Lucas Derraugh
Lucas Derraugh

Reputation: 7049

I'm assuming your 2 methods are inside the same class. If they are you can simply call
[self methodName]

Upvotes: 1

Related Questions