Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/22.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_Objective C - Fatal编程技术网

Ios 滚动视图或集合视图的性能

Ios 滚动视图或集合视图的性能,ios,objective-c,Ios,Objective C,我想创建具有tumbnail图像的胶片条形视图和具有图像名称的标签。通过点击缩略图,可以打开大图像。我不太清楚我应该使用scrollview还是collectionview 使用Collectionview,因为它是专为您所说的需求而设计的 - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{ //write your code here

我想创建具有tumbnail图像的胶片条形视图和具有图像名称的标签。通过点击缩略图,可以打开大图像。我不太清楚我应该使用scrollview还是collectionview

使用Collectionview,因为它是专为您所说的需求而设计的

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
//write your code here just like tableview
return 3;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
//configure your cells here
}

-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath  {
// this method for handling your selection of particular cell
}
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionView *)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section
{
    return 5; // This is the minimum inter item spacing, can be more
}

swift 3中的CollectionView

func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
//write your code here just like tableview
return 3
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
    //configure your cells here
}

func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
    // this method for handling your selection of particular cell
}

func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionView, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat {
    return 5
    // This is the minimum inter item spacing, can be more
}

在这条线索中,至少有一个能用解释来丰富他的答案,为什么他更喜欢其中一种观点?