Dear Friends I want to know is there any Possible to create folder like MY PHOTO app in iPhone? If it is Possible How can i implement it?

now i am trying to create. i am using UIScrollView in that My Customized UIView like added one UIImageView for set folder image.then using for loop i am creating statically and arrange one by one in one column UIView Down But they Need it will be in two column.how can i implement?

And Also How can i implement it in dynamically? i.e for each button action one by one folder creating

有帮助吗?

解决方案

Try this code and set size according to your need.

         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;

        }
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top