【问题标题】:duplicate the safari tab view switching functionality with the iphone sdk使用 iphone sdk 复制 safari 选项卡视图切换功能
【发布时间】:2010-04-25 05:21:50
【问题描述】:

我想复制移动 Safari 的标签功能中的视图切换功能。 I have implemented the scrollview containing the view screenshots, however, when a view is selected how would I duplicate the zoom animation and the title and toolbars appearing and vice-versa?

【问题讨论】:

    标签: iphone cocoa-touch iphone-sdk-3.0 mobile-safari


    【解决方案1】:

    我找到了答案,所以我会分享。

    - (void)clickHandler{
    
    // create an image that looks exactly like 
    // the preview image in your scroll view (can leave off the toolbar/statusbar if you like)
    UIImage *img = [UIImage imageNamed:@"something.png"];
    
    // create an imageview to hold the image
    UIImageView *iv = [[UIImageView alloc] initWithImage:img];
    
    // ensure that the frame is set so that it's directly over the image in your scrollview
    iv.frame = CGRectMake(60, 150, 200, 200);
    
    // push the image into the superview over top this controller's view
    [[self.view superview] insertSubview:iv aboveSubview:self.view];
    
    // refresh superview NOW
    [[self.view superview] performSelectorOnMainThread:@selector( setNeedsDisplay ) withObject:nil waitUntilDone:YES];
    
    //-----------
    //animate the image to bring it from it's "scrollview size" to the size it will be after the transition.
    
    [UIImageView beginAnimations:nil context:nil];
    [UIImageView setAnimationDuration:0.3];
    
    iv.frame = CGRectMake(0, 65, 320, 371);
    
    [UIImageView commitAnimations];
    
    //-----------   
    
    // transition to the new view using the CrossDissolve transition (or just don't animate it.)
    NewViewController *controller = [[NewViewController alloc] initWithNibName:@"NewView" bundle:nil];
    controller.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
    [self presentModalViewController:controller animated:YES];
    [controller release];
    
    // set the animated imageview to remove itself after a delay 
    // (after the new view is transitioned into place below it.)
    [iv performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:0.3];
    
    // be sure to release where needed and all that, I may have cut too much from the code for this snippet.
    // this may not be the best example, but it does work.
    // please post any improvements back so that we can all benefit
    

    }

    【讨论】:

      猜你喜欢
      • 2011-12-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-01-19
      • 1970-01-01
      相关资源
      最近更新 更多