tags:

views:

148

answers:

2

example i try to change cell.accessoryView from picture1 to picture2 by fadein

but my problem is i only have one accessoryView(one UIView)

any idea?

+1  A: 

if i understood your question properly...

you can try something like

    //-------fade out

- (void)animateFadingOut{

[UIView beginAnimations:nil context:nil];

[UIView setAnimationDuration:1.0];

[UIView setAnimationDidStopSelector:@selector(animateFadingIn)];

[UIView setAnimationDelegate:self];

//set transformation
[cell.accessoryView addSubview:NewImgeView];
cell.accessoryView.alpha = 0.0;

[UIView commitAnimations];

}
-(void)animateFadingIn{

[UIView beginAnimations:nil context:nil];

[UIView setAnimationDuration:1.0];

[UIView setAnimationDelegate:self];

//set transformation
cell.accessoryView.alpha = 1.0;

[UIView commitAnimations];

}
mihirpmehta
thnaks mihirpmehta let's me try
RAGOpoR
thanks it work pretty smooth
RAGOpoR
+1  A: 

If you want a fade, you'll have to modify your accessory view rather than reset cell.accessoryView. The simplest approach may be to give your accessory two subviews, one each for picture1 and picture2.

UIImageView *imageView1 = [[[UIImageView alloc] init] autorelease];
UIImageView *imageView2 = [[[UIImageView alloc] init] autorelease];
imageView2.alpha = 0;
[cell.accessoryView addSubview:imageView1];
[cell.accessoryView addSubview:imageView2];

Then do the following to fade between:

[UIView beginAnimations:@"" context:nil];
imageView1.alpha = 0;
imageView2.alpha = 1;
[UIView commitAnimations];
Tom
thanks Tom let me try
RAGOpoR