Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 如何制作动态图像视图?_Ios_Uiimageview - Fatal编程技术网

Ios 如何制作动态图像视图?

Ios 如何制作动态图像视图?,ios,uiimageview,Ios,Uiimageview,有一个静态图像视图(在参考图像中),但我想让它成为动态的 怎么可能呢?你可以这样做 imageView.contentMode = UIViewContentModeScaleAspectFill; //? - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{ return arrThemeImage.count; } - (UICol

有一个静态图像视图(在参考图像中),但我想让它成为动态的

怎么可能呢?

你可以这样做

imageView.contentMode = UIViewContentModeScaleAspectFill; //?
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
return arrThemeImage.count;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
NSString *identifier=@"Cell";
[collectionView registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:@"Cell"];
UICollectionViewCell *cell;

cell=[collectionView dequeueReusableCellWithReuseIdentifier:identifier forIndexPath:indexPath];

UIImageView *imgViewTheme=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 101, 101)];
NSString *strThemeImg=arrThemeImage[indexPath.row];
imgViewTheme.image=[UIImage imageNamed:strThemeImg];

[cell.contentView addSubview:imgViewTheme];


return cell;
 }

使用集合视图,不要忘记映射委托和数据源。

我建议您使用UICollectionView。请看地图

这些教程可能对您有所帮助


UICollection视图是您的最佳解决方案

你可以点击下面的链接,这将对你有所帮助


你能把问题说清楚吗?很难理解你需要什么。如果可能的话,添加一些示例代码。你说的“动态图像”是什么意思?我想让图像库像任何照片查看器软件一样添加更多细节。这里有一个关于在ios上创建gallery的教程,但我不确定这是否是你想要的:谢谢你的建议,真的很有帮助@anatoliy