2014-04-10 34 views
-3

我这个项目 IOS-Image-SwiperIOS - 如何设置图像中的UIView

工作,我想在没有成功的视图,设置图像。

self.photos = [[NSMutableArray alloc] initWithObjects: 
      [UIImage imageNamed:@"green.png"], 
      [UIImage imageNamed:@"green.png"], 
      [UIImage imageNamed:@"green.png"], 
      nil]; 

感谢您的帮助。

+0

你的问题不明确,给更多的细节 – Manimaran

+1

你说你试图在视图中设置图像...如何你是这么做的吗? (你显示一个数组,而不是一个视图。) –

+1

你上面提到的项目有些不同的方法。您必须在该项目中引用整个代码。他们用手势编写自定义视图。而且,你有什么需要清楚地说清楚? – Ramdy

回答

6
self.imgView.animationImages = @[[UIImage imageNamed:@"img1.png"], [UIImage imageNamed:@"img2.png"],[UIImage imageNamed:@"img3.png"],]; 
+0

接受我身边先生的投票。 @Mayank Jain – Steve

+0

谢谢@Steve –

+0

很棒@MayankJain –

2

试试这个:

 UIImageView *myImageView = [[UIImageView alloc] initWithImage : 
       [UIImage imageNamed :@“uiimage.png"]]; 
     UIView *myUIView = [[UIImageView alloc] initWithFrame :CGRectMake(0,10,20,40)]; 
     myUIView = myImageView; 

OR:

UIImageView *background = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"uiimage.png"]]; 
    [self addSubview:background]; 
    [self sendSubviewToBack:background]; 
2

试试这个,希望它会帮助你..

NSArray * imageArray = [NSArray arrayWithObjects:[UIImage imageNamed:@"apple5.jpg"],[UIImage imageNamed:@"green.png"],[UIImage imageNamed:@"red.png"], nil]; 

imageView.animationImages = imageArray; 
imageView.animationDuration = 4; 
[imageView startAnimating]; 
[self.view addSubview:imageView];