【问题标题】:How to create Folder like MY Photo app in iphone? [closed]如何在 iphone 中创建像我的照片应用程序这样的文件夹? [关闭]
【发布时间】:2013-02-02 06:26:55
【问题描述】:

亲爱的朋友们,我想知道有没有可能在 iPhone 中创建像 MY PHOTO 应用程序这样的文件夹?如果可能,我该如何实施?

现在我正在尝试创建。我在我的自定义 UIView 中使用 UIScrollView,例如为设置文件夹图像添加了一个 UIImageView。然后使用 for 循环我静态创建并在一列 UIView Down 中一一排列,但他们需要它将在两列中。我该如何实现?

还有我如何动态实现它?即为每个按钮操作一个一个文件夹创建

【问题讨论】:

  • 你能给出你想要的任何屏幕截图吗?一排你想要多少张图片?
  • 您可能应该展示一些到目前为止的代码。最好将您的帖子保留在一个问题上。

标签: iphone xcode uiview uiimageview uiview-hierarchy


【解决方案1】:

尝试此代码并根据需要设置大小。

         float horizontal = 8.0;
         float vertical = 8.0;
         int i;
        for(i=0; i<[arrayOfThumbImages count]; i++)
        {
            if((i%2) == 0 && i!=0)
            {
                horizontal = 8.0;
                vertical = vertical + 70.0 + 8.0;
            }
            buttonImage = [UIButton buttonWithType:UIButtonTypeCustom];
            [buttonImage setFrame:CGRectMake(horizontal, vertical, 70.0, 70.0)];
            [buttonImage setTag:i];
            [buttonImage setBackgroundImage:[arrayOfThumbImages objectAtIndex:i] forState:UIControlStateNormal];
            [buttonImage addTarget:self action:@selector(buttonImagePressed:) forControlEvents:UIControlEventTouchUpInside];
            buttonImage.layer.cornerRadius = 15;
            buttonImage.layer.masksToBounds = YES;
            [myScrollView addSubview:buttonImage];
            horizontal = horizontal + 70.0 + 8.0;

        }

【讨论】:

  • 我无法上传图片,因为我是新用户,如何提高我的信誉评分
  • 我用你的代码很好。非常感谢这两天我试过了
  • 欢迎您。请为答案投票。谢谢
猜你喜欢
  • 1970-01-01
  • 2015-12-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多