multiple uilables create dynamically
<p>i want to create a grid view using uilabels. Grid view data is based on the database table, then i don't know how many uilabels i have to add. If i add multiple uilabels in a for
loop like this,</p>

<p>float remainwidth=0;</p>

<pre><code>for(j=0;j&lt;ROW+1;j++)
{
    remainwidth=0;
for (i=0; i&lt;COLUMN; i++) {
    //NSLog(@"cell width %f label width %f cell height %f",cell.frame.size.width,width[i].width,cell.frame.size.height);
    UILabel *labelst=[[UILabel alloc] initWithFrame:CGRectMake(2+remainwidth,2+(j*(height+2)),width[i].width,height-2.0)];
    labelst.backgroundColor=[UIColor blackColor];
    labelst.textColor=[UIColor whiteColor];
    labelst.lineBreakMode=UILineBreakModeCharacterWrap;
    labelst.numberOfLines=1;
    //labelst.font=FontofCharacters;
    labelst.userInteractionEnabled=NO;
    labelst.tag=(i+1)*(j+1);
    labelst.baselineAdjustment=UIBaselineAdjustmentAlignCenters;
    labelst.textAlignment=UITextAlignmentLeft;
    labelst.text=[[griddata objectAtIndex:i] objectAtIndex:j];
    remainwidth=remainwidth+(2.0+width[i].width);
    if (j==0) {

        [self.view addSubview:labelst];
        labelst.frame=[self.view convertRect:labelst.frame fromView:Grid];
    }
    else
        [Grid addSubview:labelst];


    //labelst=nil;
    //[labelst release];

}
}
</code></pre>

<p>it works fine if colum less than 4, if i set colum 5 then the app get "EXC_BAD_ACCESS" after showing the table in view. Please help me how to manage this problem and how to maintain multiple uilabels; </p>

<p>thanks!</p>
