0

I am new to this field. I have used 8 UIImageView inside the UIVIEW.

 @property(weak,nonatomic)IBOutlet UIImageView *b1; @property(weak,nonatomic)IBOutlet UIImageView *b2; @property(weak,nonatomic)IBOutlet UIImageView *b3; @property(weak,nonatomic)IBOutlet UIImageView *b4; @property(weak,nonatomic)IBOutlet UIImageView *Bb1; @property(weak,nonatomic)IBOutlet UIImageView *Bb2; @property(weak,nonatomic)IBOutlet UIImageView *Bb3; @property(weak,nonatomic)IBOutlet UIImageView *Bb4; @property(weak,nonatomic)IBOutlet UIView *VVV; 

I NEED : WHEN THE UIViewController LOAD first 4 UIImageView (b1,b2,b3,b4 images)should display which is already set .then after 5s this 4 UIImageView should flip (for b1 img it should display the Bb1 img, same case for b2 img after flip it should display Bb2 img, same for b3-Bb3,b4-Bb4 img)then after flip for 5s it should display the b1,b2,b3,b4 img in UIImageView.

IMP:I NEED WHILE

viewDidLoad

not in button action .

1 Answer 1

1

You don't need to create Bb1-4 views to flip images in UIImageView. In general there are different ways to make transition from one image to another. Some of them are described in this answer(not mine, credits go to sergio): UIView flip animation

Also there is a way to animate .image change in UIImageView:

+ (void)transitionWithView:(UIView *)view duration:(NSTimeInterval)duration options:(UIViewAnimationOptions)options animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion 

Check apple docs about this: https://developer.apple.com/documentation/uikit/uiview/1622451-animatewithduration

Example of usage:

UIImage *imageOne = [UIImage imageNamed:@"b1"]; UIImage *imageTwo = [UIImage imageNamed:@"bb1"]; UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)]; imageView.image = imageOne; [UIView transitionWithView:imageView duration:2.0 options:UIViewAnimationOptionTransitionFlipFromRight animations:^{ imageView.image = imageTwo; } completion:nil]; 

Here imageView is animating from imageOne to imageTwo with flip.

Sign up to request clarification or add additional context in comments.

3 Comments

i have set the Bb1-Bb4 as UIImageView
i not understood how to do
I added an example how to animate image in UIImageView. Is it clear for you how to do this? As far as I see you need to repeat this operation each 5 second. And image should swap from one to another each time?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.