开发者

TableView cell frame problem

I am developing an application that has a view as shown in image. I am having a table view. My problem is how will I show my chat boxes cell some right to the original Table viewcell frame.

TableView cell frame problem

Like The white box is some right to the original table view cell

code:-

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *CellIdentifier = @"Cell";
    int row = [indexPath section];

    UITableViewCell *startCell = [[[UITableViewCell alloc] initWithFrame:CGRectMake(10, 0, 200, 50)  reuseIdentifier:CellIdentifier] autorelease];
    UITableViewCell *durationCell = [[[UITableViewCell alloc] initWithFrame:CGRectMake(50, 0, 200, 100) reuseIdentifier:CellIdentifier] autorelease];
    UITableViewCe开发者_C百科ll *radiusCell = [[[UITableViewCell alloc] initWithFrame:CGRectMake(100, 0, 200, 150) reuseIdentifier:CellIdentifier] autorelease];

    startCell.textLabel.text = @"Start:";
    durationCell.textLabel.text = @"Duration:";
    radiusCell.textLabel.text = @"radius";


    if (row == 0)
    {
        return startCell;
    }
    else if (row == 1)
    {
        return durationCell;
    }

    return radiusCell;


}


if your cell contains UIImageView then you have to create custom cells . In custom cell 's .m file you have to create a method called - (void)layoutSubviews in that method write code for image view like

   `CGRectMake frame= CGRectMake(5, 12, 19, 15);    
    myImageView.frame = frame;`


You need to set frame of the view which is inside cell in cellForRowAtIndexPath method or you can make custom cell and position it where ever you want.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜