如何将图像添加到UIView中

时间:2011-04-04 06:48:29

标签: uiview

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

1 个答案:

答案 0 :(得分: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 ];
功能

中的

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];

}