It looks like you're new here. If you want to get involved, click one of these buttons!
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *MyIdentifier = @\"MyIdentifier\";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:MyIdentifier] autorelease];
cell.textLabel.font = [UIFont fontWithName:@\"Helvetica\" size:15.0];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cellimage =[[UIView alloc] initWithFrame:CGRectMake(0, 0, 275, 30)];
[cell.contentView addSubview:cellimage];
CGRect attributeNameRect = CGRectMake(0, 0, 138, 29);
attributeName = [[UILabel alloc] initWithFrame:attributeNameRect];
attributeName.textAlignment = UITextAlignmentCenter;
attributeName.textColor = [UIColor blackColor];
attributeName.font = [UIFont systemFontOfSize:12];
attributeName.backgroundColor = [UIColor clearColor];
attributeName.layer.borderColor = [UIColor grayColor].CGColor;
attributeName.layer.borderWidth = 1.0;
attributeName.tag = 1;
// [attributeName release];
CGRect nameValueRect = CGRectMake(138, 0, 57, 29);
nameValue = [[UILabel alloc] initWithFrame:nameValueRect];
nameValue.textAlignment = UITextAlignmentCenter;
nameValue.textColor = [UIColor blackColor];
nameValue.font = [UIFont systemFontOfSize:12];
nameValue.backgroundColor = [UIColor clearColor];
nameValue.layer.borderColor = [UIColor grayColor].CGColor;
nameValue.layer.borderWidth = 1.0;
nameValue.tag = 2;
// [nameValue release];
CGRect PercentageRect = CGRectMake(195, 0, 80, 29);
visitorPercentage = [[UILabel alloc] initWithFrame:PercentageRect];
visitorPercentage.textAlignment = UITextAlignmentCenter;
visitorPercentage.textColor = [UIColor blackColor];
visitorPercentage.font = [UIFont systemFontOfSize:12];
visitorPercentage.backgroundColor = [UIColor clearColor];
visitorPercentage.layer.borderColor = [UIColor grayColor].CGColor;
visitorPercentage.layer.borderWidth = 1.0;
visitorPercentage.tag = 3;
// [visitorPercentage release];
}
switch (indexPath.row) {
case 0:
{
attributeName.text = @\"visitor:\";
[cellimage addSubview:attributeName];
nameValue.text = [NSString stringWithFormat:@\"%@\",[[records objectAtIndex:0] objectAtIndex:0]];
[cellimage addSubview:nameValue];
visitorPercentage.text = @\"25%\";
[cellimage addSubview:visitorPercentage];
break;
}
case 1:
{
attributeName.text = @\"uniqueVisitor:\";
[cellimage addSubview:attributeName];
nameValue.text = [NSString stringWithFormat:@\"%@\",[[records objectAtIndex:0] objectAtIndex:1]];
[cellimage addSubview:nameValue];
visitorPercentage.text = @\"25%\";
[cellimage addSubview:visitorPercentage];
break;
}
case 2:
{
attributeName.text = @\"order:\";
[cellimage addSubview:attributeName];
nameValue.text = [NSString stringWithFormat:@\"%@\",[[records objectAtIndex:0] objectAtIndex:2]];
[cellimage addSubview:nameValue];
visitorPercentage.text = @\"25%\";
[cellimage addSubview:visitorPercentage];
break;
}
case 3:
{
attributeName.text = @\"revenue:\";
[cellimage addSubview:attributeName];
nameValue.text = [NSString stringWithFormat:@\"%@\",[[records objectAtIndex:0] objectAtIndex:3]];
[cellimage addSubview:nameValue];
visitorPercentage.text = @\"25%\";
[cellimage addSubview:visitorPercentage];
break;
}
case 4:
{
attributeName.text = @\"conversionRate:\";
[cellimage addSubview:attributeName];
nameValue.text = [NSString stringWithFormat:@\"%@\",[[records objectAtIndex:0] objectAtIndex:4]];
[cellimage addSubview:nameValue];
visitorPercentage.text = @\"25%\";
[cellimage addSubview:visitorPercentage];
break;
}
case 5:
{
attributeName.text = @\"newProduct:\";
[cellimage addSubview:attributeName];
nameValue.text = [NSString stringWithFormat:@\"%@\",[[records objectAtIndex:0] objectAtIndex:5]];
[cellimage addSubview:nameValue];
visitorPercentage.text = @\"25%\";
[cellimage addSubview:visitorPercentage];
break;
}
case 6:
{
attributeName.text = @\"outOfStockProduct:\";
[cellimage addSubview:attributeName];
nameValue.text = [NSString stringWithFormat:@\"%@\",[[records objectAtIndex:0] objectAtIndex:6]];
[cellimage addSubview:nameValue];
visitorPercentage.text = @\"25%\";
[cellimage addSubview:visitorPercentage];
break;
}
case 7:
{
attributeName.text = @\"productInCart:\";
[cellimage addSubview:attributeName];
nameValue.text = [NSString stringWithFormat:@\"%@\",[[records objectAtIndex:0] objectAtIndex:7]];
[cellimage addSubview:nameValue];
visitorPercentage.text = @\"25%\";
[cellimage addSubview:visitorPercentage];
break;
}
case 8:
{
attributeName.text = @\"visitorInc:\";
[cellimage addSubview:attributeName];
nameValue.text = [NSString stringWithFormat:@\"%@\",[[records objectAtIndex:0] objectAtIndex:8]];
[cellimage addSubview:nameValue];
visitorPercentage.text = @\"25%\";
[cellimage addSubview:visitorPercentage];
break;
}
case 9:
{
attributeName.text = @\"uniqueVisitorInc:\";
[cellimage addSubview:attributeName];
nameValue.text = [NSString stringWithFormat:@\"%@\",[[records objectAtIndex:0] objectAtIndex:9]];
[cellimage addSubview:nameValue];
visitorPercentage.text = @\"25%\";
[cellimage addSubview:visitorPercentage];
break;
}
case 10:
{
attributeName.text = @\"orderInc:\";
[cellimage addSubview:attributeName];
nameValue.text = [NSString stringWithFormat:@\"%@\",[[records objectAtIndex:0] objectAtIndex:10]];
[cellimage addSubview:nameValue];
visitorPercentage.text = @\"25%\";
[cellimage addSubview:visitorPercentage];
break;
}
case 11:
{
attributeName.text = @\"revenueInc:\";
[cellimage addSubview:attributeName];
nameValue.text = [NSString stringWithFormat:@\"%@\",[[records objectAtIndex:0] objectAtIndex:11]];
[cellimage addSubview:nameValue];
visitorPercentage.text = @\"25%\";
[cellimage addSubview:visitorPercentage];
break;
}
case 12:
{
attributeName.text = @\"ConvertionRateInc:\";
[cellimage addSubview:attributeName];
nameValue.text = [NSString stringWithFormat:@\"%@\",[[records objectAtIndex:0] objectAtIndex:11]];
[cellimage addSubview:nameValue];
visitorPercentage.text = @\"25%\";
[cellimage addSubview:visitorPercentage];
break;
}
case 13:
{
attributeName.text = @\"newProductInc:\";
[cellimage addSubview:attributeName];
nameValue.text = [NSString stringWithFormat:@\"%@\",[[records objectAtIndex:0] objectAtIndex:11]];
[cellimage addSubview:nameValue];
visitorPercentage.text = @\"25%\";
[cellimage addSubview:visitorPercentage];
break;
}
case 14:
{
attributeName.text = @\"outOfStockProductInc:\";
[cellimage addSubview:attributeName];
nameValue.text = [NSString stringWithFormat:@\"%@\",[[records objectAtIndex:0] objectAtIndex:11]];
[cellimage addSubview:nameValue];
visitorPercentage.text = @\"25%\";
[cellimage addSubview:visitorPercentage];
break;
}
case 15:
{
attributeName.text = @\"productInCartInc:\";
[cellimage addSubview:attributeName];
nameValue.text = [NSString stringWithFormat:@\"%@\",[[records objectAtIndex:0] objectAtIndex:11]];
[cellimage addSubview:nameValue];
visitorPercentage.text = @\"25%\";
[cellimage addSubview:visitorPercentage];
break;
}
default:
break;
}
return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return 30;
}
Replies
Add all your cellimage subviews and tag them inside the cell == nil. Then get references to them outside your cell == nil by calling viewWithTag on cellimage.
Also, where did you define cellimage and all your other subviews?
And one more thing, please use code tags from now, [CODE] [1/CODE] without the 1.
New app - See screenshots and details at www.globaclock.com.
If you want to
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesomethanks brother...it works now
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome