Why does this:
Profile *showProfile = [[Profile alloc] init];
showProfile = [profileArray objectAtIndex:indexPath.row];
if([[showProfile lastName] length] > 0){
NSString *cellValue = [NSString stringWithFormat:@"%@ %@", [showProfile lastName], [showProfile firstName]];
[[cell textLabel] setText:cellValue];
}
Show the text on the UITableViewCell not on the left side. I can’t post an image to show you, but this is killing me. The text seems to be more centered.
But if I do this:
Profile *showProfile = [[Profile alloc] init];
showProfile = [profileArray objectAtIndex:indexPath.row];
if([[showProfile lastName] length] > 0){
NSString *cellValue = @"This is aligned properly";
[[cell textLabel] setText:cellValue];
}
The text is fine.
Are you sure that your lastname doesn’t have any whitespaces in front of it? Try trimming the string like this:
Also note that you currently allocate a Profile object that is never used! Instead of:
simply use this:
Otherwise you always first create a new profile object you never use, which takes time.