C-Objective Function

Posted by nimbus on Programmers See other posts from Programmers or by nimbus
Published on 2012-10-20T00:32:29Z Indexed on 2012/10/20 5:21 UTC
Read the original article Hit count: 351

Filed under:

I'm unsure about how to make MWE with C-Obective, so if you need anything else let me know.

I am trying running through a tutorial on building an iPhone app and have gotten stuck defining a function. I keep getting an error message saying "use of undeclared indentifer." However I believe I have initiated the function.

In the view controller I have:

if (scrollAmount > 0) {
    moveViewUp = YES;  
    [scrollTheView:YES];
}
else{ 
    moveViewUp = NO;
}

with the function under it

- (void)scrollTheView:(BOOL)movedUp {
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:0.3];
    CGRect rect = self.view.frame;
    if (movedUp){
        rect.origin.y -= scrollAmount;
    }
    else {
        rect.origin.y += scrollAmount;
    }
    self.view.frame = rect;
    [UIView commitAnimations];

}

I have initiated the function in the header file (that I have imported).

- (void)scrollTheView:(BOOL)movedUp;

Any help would be appreciated,

thank you in advanced

© Programmers or respective owner

Related posts about objective-c