亲爱的朋友们我想知道是否有可能在iPhone中创建 MY PHOTO 应用程序等文件夹?如果可能我该如何实现它?
现在我正在努力创造。我正在使用UIScrollView,我的自定义UIView为添加了一个UIImageView用于设置文件夹image.then使用for循环我正在静态创建并在一列中逐个排列UIView Down但是他们需要它将在两列中。我可以实现?
此外,我如何动态实现它?即每个按钮动作逐个创建文件夹
答案 0 :(得分: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;
}