uiimageview iPhone 中的选框效果



如何在UIImage中实现选框效果动画。

我有一个云的图像(320 * 480)。我需要从右连续地向左动画,没有任何滞后和消失。下面是一个 html 示例。

http://www.quackit.com/html/codes/html_marquee_code.cfm

倒数第二(连续滚动文本:)。

请帮忙

UIImage *clouds = [UIImage imageNamed:@"Clouds"];
UIImageView *cloudView = [[UIImageView alloc] initWithImage:clouds];
CGRect origin = CGRectMake(320, 0, clouds.size.width, clouds.size.height);
CGRect destination = CGRectMake(0, 0, clouds.size.width, clouds.size.height);
cloudView.frame = origin;
[self.view addSubview:cloudView];
[UIView animateWithDuration:5 delay:0 options:UIViewAnimationOptionRepeat | UIViewAnimationOptionCurveLinear animations:^{
    cloudView.frame = destination;
} completion:nil];

这样做:

-(void)marqueeEffect
{
  imgView.frame = CGRectMake(self.view.frame.origin.y,50,320,480); //right frame
  //increase time duration as per requirement
  [UIView animateWithDuration:3.0
                      delay: 0.0
                    options: UIViewAnimationCurveEaseOut
                 animations:^{
                      imgView.frame = CGRectMake(-imgview.frame.size.width,50,320,480); //left frame
                 }
                 completion:^(BOOL finished){
                      [self performSelector:@selector(marqueeEffect)];
                 }];
 }

试试这个例子,它用于UILABEL:

int x;
@synthesize label;
- (void)viewDidLoad
{
    [super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
    label=[[UILabel alloc]initWithFrame:CGRectMake(300, 400, 150, 30)];
    label.text=@"WWW.SONGS.PK";
    label.backgroundColor=[UIColor clearColor];
    x=300;
    [NSTimer scheduledTimerWithTimeInterval:.01 target:self selector:@selector(clickme) userInfo:nil repeats:YES];
}
-(void)clickme
{
    x--;
    label.frame=CGRectMake(x, 400, 150, 30);
    if( x==-150)
    {
        x=300;
    }
    [self.view addSubview:label];
}

最新更新