I want to move the position of the title textview in my cell prototype. When I select the "Title" I cannot adjust the X,Y coordinates or even the Width and Height. Are we not allowed to customize this part of the cell.
When I tried to do this in code it said I was not allowed to access the current parameter. How do I move the location of this title and subtitle. I want to move it to the top of the cell and have my colored views below. Thanks in advance, still somewhat new to Xcode.
cell.textLabel.frame.origin.x = 30; //not allowed to access
you cannot access to the x position, but you can put the whole frame easily. Here and example all by code, I think It's your best option:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *reuseIdentifier = @"reuseIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:reuseIdentifier];
if (!cell)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:reuseIdentifier];
cell.textLabel.frame = CGRectMake(0, 0, cell.frame.size.width, 30);
cell.textLabel.backgroundColor = [UIColor greenColor];
}
// Configure your cell...
return cell;
}
Here using Story cell, I think is worse because more work.(It didn't take advantage for the reuse technology at all).
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"storyIdentifier" forIndexPath:indexPath];
cell.textLabel.frame = CGRectMake(0, 0, cell.frame.size.width, 30);
cell.textLabel.backgroundColor = [UIColor greenColor];
// Configure your cell...
return cell;
}