Search code examples
iphonetextfading

ipnoe development ..need to fade text over a back ground image


i wish to have a lable with text that appears and the slowly fades over a background image. and have a lable on the image with text but i wish it to stay for i second and then gradualy fade im using xcode and utalising interface builder. thanks


Solution

  • Well if you have a UIImage and UILabel linked from the Interface Builder, place the following in the viewdidload: method:

    // Starting state
    myLabel.alpha=0.0;
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:1.0];
    // Ending state
    myLabel.alpha=1.0;
    [UIView commitAnimations];
    
    // Run another function to fade out after a second
    [self performSelector:@selector(fadeOut:) withObject:sender afterDelay:1.0];