开发者

UIAlertView display as slowly

I created UIAlertview for my application as follows.

NSString *message=@"\n\n\n\n\n\n\n\n\n";
UIALertView *successAlert = [[UIAlertView alloc] initWithTitle:@"title" message:message delegate:nil cancelButtonTitle:nil otherButtonTitles:nil];
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(12, 8, 260, 274)];
NSData *mydata = [[NSData alloc] initWithContentsOfURL:开发者_运维百科[NSURL URLWithString:[images objectAtIndex:indexPath.row]]];
UIImage *bkgImg = [[UIImage alloc] initWithData:mydata ];
[imageView setImage:bkgImg];
[bkgImg release];
[mydata release];
[successAlert addSubview:imageView];
[imageView release];
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
UIImage* myButtonImage = [UIImage imageNamed:@"Close.png"];
[button setImage:myButtonImage forState:UIControlStateNormal];
[button addTarget:self action:@selector(aMethod:) forControlEvents:UIControlEventTouchDown];
[button setTitle:@"Show View" forState:UIControlStateNormal];
button.frame = CGRectMake(255.0, 10.0, 15.0, 15.0);
[successAlert addSubview:button];
[successAlert show];

But the above code display alert as fast movement, it will display suddenly. Now I need to display alert view as slowly as popup, like a slideshow.

How to display UIAlertview like as slideshow format as slowly?


i got answer like as slideshow preview...

      -(void)tableView:(UITableView *)tableView1 didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
       NSString *message=@"\n\n\n\n\n\n\n\n\n";
       UIALertView *successAlert = [[UIAlertView alloc] initWithTitle:@"title" message:message delegate:nil cancelButtonTitle:nil otherButtonTitles:nil];
      UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(12, 8, 260, 274)];
      NSData *mydata = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:[images objectAtIndex:indexPath.row]]];
      UIImage *bkgImg = [[UIImage alloc] initWithData:mydata ];
      [imageView setImage:bkgImg];
      [bkgImg release];
      [mydata release];
      [successAlert addSubview:imageView];
      [imageView release];
      UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
      UIImage* myButtonImage = [UIImage imageNamed:@"Close.png"];
      [button setImage:myButtonImage forState:UIControlStateNormal];
      [button addTarget:self action:@selector(aMethod:) forControlEvents:UIControlEventTouchDown];
      [button setTitle:@"Show View" forState:UIControlStateNormal];
      button.frame = CGRectMake(255.0, 10.0, 15.0, 15.0);
      [successAlert addSubview:button];
      [successAlert show];
      [self pulse];
      }


         float pulsesteps[3] = { 1.8, 1/15.0, 1/7.5 };

       -(void) pulse 
       {
        successAlert.transform = CGAffineTransformMakeScale(0.1,0.1);
        [UIView beginAnimations:nil context:nil];
        [UIView setAnimationDuration:pulsesteps[0]];
        [UIView setAnimationDelegate:self];
        [UIView setAnimationDidStopSelector:@selector(pulseGrowAnimationDidStop:finished:context:)];
        successAlert.transform = CGAffineTransformMakeScale(1.1, 1.1);
        [UIView commitAnimations];
       }
       -(void)pulseGrowAnimationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context {
        [UIView beginAnimations:nil context:NULL];
        [UIView setAnimationDuration:pulsesteps[1]];
        [UIView setAnimationDelegate:self];
                [UIView setAnimationDidStopSelector:@selector(pulseShrinkAnimationDidStop:finished:context:)];
        successAlert.transform = CGAffineTransformMakeScale(1.0, 1.0);
        [UIView commitAnimations];
      }           
       -(void)pulseShrinkAnimationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context {
        [UIView beginAnimations:nil context:NULL];
        [UIView setAnimationDuration:pulsesteps[2]];
        successAlert.transform = CGAffineTransformIdentity;
        [UIView commitAnimations];
      }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜