2012-11-23 41 views

回答

2

看到這個最佳的CoverFlow與許多類型.....

  1. iCarousel //只需更改與您的要求的類型,在這個例子中,你讓每一個類型的圖像顯示/輸出的動畫
  2. openflow

而且,如果你想設置的圖像上滾動型從ImagePath的兩個oriantation那麼這就是我創建使用它..只是改變你想要的一些代碼簡單的方法..

-(void) imageFromImagePath : (NSString *) path { 

    UIInterfaceOrientation orientation = [[UIDevice currentDevice] orientation]; 
    imageView = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:path]]; 
    UIImage *img = [UIImage imageWithContentsOfFile:path]; 

    if (img != nil) { 
     [imageView setBackgroundColor:[UIColor clearColor]]; 
     fullFrame = imageView.frame; 

     float expWidth, expHeight, orgWidth, orgHeight; 

     orgWidth = imageView.frame.size.width; 
     orgHeight = imageView.frame.size.height; 

     if (orgWidth < orgHeight) { 

      if (orientation == UIDeviceOrientationLandscapeLeft || orientation == UIDeviceOrientationLandscapeRight) { 
       expWidth = 480; 
       expHeight = (orgHeight * expWidth)/orgWidth; 

       if (expHeight < 300) { 
        expHeight = 300; 
        expWidth = (orgWidth * expHeight)/orgHeight; 
       }   
      } 
      else { 

       expWidth = 320; 
       expHeight = (orgHeight * expWidth)/orgWidth; 

       if (expHeight < 460) { 
        expHeight = 460; 
        expWidth = (orgWidth * expHeight)/orgHeight; 
       } 
      } 
     } 
     else {  

      if (orientation == UIDeviceOrientationLandscapeLeft || orientation == UIDeviceOrientationLandscapeRight) { 
       expHeight = 300; 
       expWidth = (orgWidth * expHeight)/orgHeight; 

       if (expWidth < 480) { 
        expWidth = 480; 
        expHeight = (orgHeight * expWidth)/orgWidth; 
       }   
      } 
      else {   
       expHeight = 460; 
       expWidth = (orgWidth * expHeight)/orgHeight; 

       if (expWidth < 320) { 
        expWidth = 320; 
        expHeight = (orgHeight * expWidth)/orgWidth; 
       } 
      }  
     } 

     imageView.contentMode = UIViewContentModeScaleToFill; 
     imageView.image = img; 
     [scroller addSubview:imageView]; 
     [imageView release]; 
     [scroller bringSubviewToFront:scrollingWheel]; 
     //[self addSubview:scroller]; 

     [imageView setNeedsLayout]; 
     [imageView setNeedsDisplay]; 

     imgWidth = expWidth; 
     imgHeight = expHeight; 
     [scrollingWheel stopAnimating]; 

     imageView.frame = CGRectMake(0,0,expWidth,expHeight); 

     //scroller.frame = CGRectMake(0,0,expWidth,expHeight); 
     scroller.contentSize = CGSizeMake(expWidth, expHeight); 
    } 
    else { 

    } 

    //[self performSelector:@selector(hideScrollingWheel) withObject:nil afterDelay:1.0]; 
} 
相關問題