如何将图像添加到UIView中

avi*_*ash 2 uiview

我有4张图片.我想逐个在UIView中添加图像.请给我任何想法.如何在UIView中添加图像数组.

Mih*_*hta 6

从你的问题不清楚,但我猜你想在一段时间后延迟一个接一个地在你的视图中显示图像...如果它是你想要的你面包车得到它

[self performSelector:@selector(callFunction) withObject:nil afterDelay:0 ];
[self performSelector:@selector(callFunction2) withObject:nil afterDelay:k_AnimateTime ];
[self performSelector:@selector(callFunction3) withObject:nil afterDelay:2*k_AnimateTime ];
Run Code Online (Sandbox Code Playgroud)

在函数中

imageview = [[[UIImageView alloc] initWithFrame:CGRectMake(x,y,w,h)]autorelease];
    imageview.image = [[UIImage imageNamed: [NSString stringWithString:name]]autorelease];
    [self.view addSubview:imageview];
    imageview.frame = CGRectMake(imageview.frame.origin.x, (imageview.frame.origin.y), imageview.frame.size.width, imageview.frame.size.height);
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDelegate:self];
    //[UIView setAnimationWillStartSelector:@selector(Transform2)];


    [UIView setAnimationDuration:k_AnimateTime];

    [UIView setAnimationBeginsFromCurrentState:YES];
    //[UIView setAnimationDidStopSelector:@selector(increaseCount)];
    imageview.frame = CGRectMake(imageview.frame.origin.x - Ex, (imageview.frame.origin.y - Ey), imageview.frame.size.width, imageview.frame.size.height);
    [UIView commitAnimations];

    [self.view addSubview:imageview];

}
Run Code Online (Sandbox Code Playgroud)