views:

35

answers:

1

Can someone just clarify how UIView works in this context? Is it just part of the view controller (i.e. the view that is part of my ViewController.xib). I was puzzled for a second as it felt like I should have been declaring it somewhere, I wanted to call beginAnimations but was not sure what to call it on.

@implementation ViewController
@synthesize fadeText_001;

-(IBAction)pressToFade:(id)sender {
    NSLog(@"pressFade ...");
    UIButton *button = (UIButton *)sender;

    [fadeText_001 setAlpha:1.0];
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:1.5];
    [fadeText_001 setAlpha:0.0];
    [UIView commitAnimations];
}

Cheers gary

+2  A: 

beginAnimations:context:, setAnimationDuration: and commitAnimations are class methods, so you call them on the UIView class itself, not a UIView instance.

The class itself is declared through UIKit.h, which is #imported by default.

Can Berk Güder
Ah I see, that makes perfect sense, thank you, much appreciated.
fuzzygoat