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

Ios 如果数据不可用,则在集合视图中显示精确的网格设计

Ios 如果数据不可用,则在集合视图中显示精确的网格设计,ios,objective-c,iphone,swift,Ios,Objective C,Iphone,Swift,我想显示网格设计如下图所示。如果没有可用数据。您可以使用只显示白色背景的空UICollectionViewCell。在numberOfItemsInSection中,只需将视图向外填充,即可显示几个额外的空单元格。然后,在加载数据时,只需将numberOfItemsInSection设置为反映数据的正确数字 我当然可以向您推荐这个伟大的图书馆,它将代表您工作。您可以轻松地设置占位符(普通字符串、属性字符串或图像)来代替UICollectionView或UITableView 当你有数据时,只需重


我想显示网格设计如下图所示。如果没有可用数据。

您可以使用只显示白色背景的空UICollectionViewCell。在numberOfItemsInSection中,只需将视图向外填充,即可显示几个额外的空单元格。然后,在加载数据时,只需将numberOfItemsInSection设置为反映数据的正确数字

我当然可以向您推荐这个伟大的图书馆,它将代表您工作。您可以轻松地设置占位符(普通字符串、属性字符串或图像)来代替
UICollectionView
UITableView

当你有数据时,只需重新加载你的对象,它就会隐藏占位符

使用:


有关更多信息和用法,请查看以上链接。

您可以这样做

   - (NSInteger)numberOfItemsInSection:(NSInteger)section
      {
          int numberOfItem =0;

          numberOfItem = array.count+1;
          return numberOfItem;

       }


    - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView1 cellForItemAtIndexPath:(NSIndexPath *)indexPath
   {
     static NSString *identifier = @"Cell";

     UICollectionViewCell *cell = (UICollectionViewCell *)[collectionView dequeueReusableCellWithReuseIdentifier:identifier forIndexPath:indexPath];
     if(indexPath.row==array.count)
      {
           //////////load upload image with top icon hidden
       }
    else{
           /////////load your image with top icon unhidden
         }
  return cell;
      }
   - (NSInteger)numberOfItemsInSection:(NSInteger)section
      {
          int numberOfItem =0;

          numberOfItem = array.count+1;
          return numberOfItem;

       }


    - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView1 cellForItemAtIndexPath:(NSIndexPath *)indexPath
   {
     static NSString *identifier = @"Cell";

     UICollectionViewCell *cell = (UICollectionViewCell *)[collectionView dequeueReusableCellWithReuseIdentifier:identifier forIndexPath:indexPath];
     if(indexPath.row==array.count)
      {
           //////////load upload image with top icon hidden
       }
    else{
           /////////load your image with top icon unhidden
         }
  return cell;
      }