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.
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.
精彩评论