-1
 static NSString *CellIdentifier = @"Cell";

        tblcell = (tablecellView*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
        if (tblcell == nil)
        {
            NSArray *outlets;
            if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
            {
                outlets = [[NSArray alloc] initWithArray:[[NSBundle mainBundle] loadNibNamed:@"tablecellView" owner:nil options:nil] ] ;

            }
            else
            {
                outlets = [[NSArray alloc] initWithArray:[[NSBundle mainBundle] loadNibNamed:@"tablecellView_ipad" owner:nil options:nil] ] ;

            }

            for (id currentObject in outlets)
            {
                if ([currentObject isKindOfClass:[UITableViewCell class]])
                {
                    tblcell = (tablecellView *) currentObject;
                    break;
                }
            }

        }
        i = indexPath.row*4;

        if (i < [imagearray count])
        {
            tblcell.viewa.hidden=FALSE;
            tblcell.viewa.layer.borderColor = [UIColor colorWithRed:191.0f/255.0f green:191.0f/255.0f blue:191.0f/255.0f alpha:1.0f].CGColor;
             tblcell.viewa.layer.borderWidth=1.0f;
            NSURL *urla;

            urla = [NSURL URLWithString:[NSString stringWithFormat:@"%@",[imagearray objectAtIndex:i]]];

            [tblcell.imga setImageWithURL:urla placeholderImage:[UIImage imageNamed:@"ncam.png"]];
            [tblcell.btna.titleLabel setText:[NSString stringWithFormat:@"%d",i]];
            [tblcell.btna addTarget:self action:@selector(btnimage:) forControlEvents:UIControlEventTouchUpInside];
        }
        i++;

        if (i < [imagearray count])
        {
            tblcell.viewb.hidden=FALSE;
            tblcell.viewb.layer.borderColor = [UIColor colorWithRed:191.0f/255.0f green:191.0f/255.0f blue:191.0f/255.0f alpha:1.0f].CGColor;
             tblcell.viewb.layer.borderWidth=1.0f;
            NSURL *urlb;

            urlb = [NSURL URLWithString:[NSString stringWithFormat:@"%@",[imagearray objectAtIndex:i]]];

            [tblcell.imgb setImageWithURL:urlb placeholderImage:[UIImage imageNamed:@"ncam.png"]];
            [tblcell.btnb.titleLabel setText:[NSString stringWithFormat:@"%d",i]];
            [tblcell.btnb addTarget:self action:@selector(btnimage:) forControlEvents:UIControlEventTouchUpInside];
        }
        i++;

        if (i < [imagearray count])
        {
            tblcell.viewc.hidden=FALSE;
             tblcell.viewc.layer.borderColor = [UIColor colorWithRed:191.0f/255.0f green:191.0f/255.0f blue:191.0f/255.0f alpha:1.0f].CGColor;
             tblcell.viewc.layer.borderWidth=1.0f;
            NSURL *urlc;

            urlc = [NSURL URLWithString:[NSString stringWithFormat:@"%@",[imagearray objectAtIndex:i]]];
            [tblcell.imgc setImageWithURL:urlc placeholderImage:[UIImage imageNamed:@"ncam.png"]];
            [tblcell.btnc.titleLabel setText:[NSString stringWithFormat:@"%d",i]];
            [tblcell.btnc addTarget:self action:@selector(btnimage:) forControlEvents:UIControlEventTouchUpInside];
        }
        i++;

        if (i < [imagearray count])
        {
            tblcell.viewd.hidden=FALSE;

            tblcell.viewd.layer.borderColor = [UIColor colorWithRed:191.0f/255.0f green:191.0f/255.0f blue:191.0f/255.0f alpha:1.0f].CGColor;
            tblcell.viewd.layer.borderWidth=1.0f;

            NSURL *urld;
            urld = [NSURL URLWithString:[NSString stringWithFormat:@"%@",[imagearray objectAtIndex:i]]];

            [tblcell.imgd setImageWithURL:urld placeholderImage:[UIImage imageNamed:@"ncam.png"]];
            [tblcell.btnd.titleLabel setText:[NSString stringWithFormat:@"%d",i]];
            [tblcell.btnd addTarget:self action:@selector(btnimage:) forControlEvents:UIControlEventTouchUpInside];
        }
        i++;

        return tblcell;

    }

==============行数

if (tableView == GridTableview)
        {

            return (imagearray.count/4)+1;
        }
4

2 に答える 2

0

UITableView の代わりに UICollectionView を使用する必要があります。以下に示すリンクは、これに関して役立ちます->

http://www.appcoda.com/ios-programming-uicollectionview-tutorial/

http://skeuo.com/uicollectionview-custom-layout-tutorial

http://mobile.tutsplus.com/tutorials/iphone/uicollectionview-layouts/

http://adoptioncurve.net/archives/2012/09/a-simple-uicollectionview-tutorial/

http://maniacdev.com/2012/09/tutorial-how-to-create-an-ios-6-uicollectionview-using-storyboards/

ではごきげんよう...

于 2013-03-07T06:21:45.540 に答える
0

必要に応じて以下のリンクを確認してください

ここをチェック

それがあなたに役立つことを願っています

于 2013-03-07T06:09:11.023 に答える