У меня UItableview с пользовательской ячейкой. Пользовательская ячейка имеет изображение с множеством деталей. Но моя прокрутка нервная. Как я могу улучшить производительность прокрутки?
Я публикую свой код здесь:
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSUInteger row = [indexPath row];
Theo1AppDelegate *iDelegate = [[UIApplication sharedApplication] delegate];
static NSString * ListitemCellIdentifier = @"ListitemCellIdentifier";
ListItemCell * cell = (ListItemCell *)[tableView dequeueReusableCellWithIdentifier:ListitemCellIdentifier];
if( cell == nil )
{
[[NSBundle mainBundle] loadNibNamed:@"ListItemCell" owner:self options:nil];
cell = self.mCell;
self.mCell = nil;
}
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
SampleObject * p = nil;
p = [self.mSelections objectAtIndex:row ];
cell.tag = row;
cell.mPropertyLabel.text = [p Address];
NSString * comboStr1 = [NSString stringWithFormat:@"%d ", (int)[p.mBeds doubleValue] ];
cell.mBedBathSqftLabel.text = comboStr1;
NSNumber * number = [NSNumber numberWithDouble:[p.mBaths doubleValue]];
NSString * string = [number stringValue];
int le = [string length];
if(le == 1)
{
cell.mBathLabel.frame = CGRectMake(590, 60, 30, 23);
cell.mBathLabel.text = string;
}
else if(le == 3)
{
cell.mBathLabel.frame = CGRectMake(590, 60, 35, 23);
cell.mBathLabel.text = string;
}
else if(le == 4)
{
cell.mBathLabel.frame = CGRectMake(590, 60, 40, 23);
cell.mBathLabel.text = string;
}
int sqftval = [p.mLivingArea intValue];
NSString * sqft = @"";
if(sqftval == 0)
{
cell.mSqftLabel.text =@"NA";
}
else
{
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
[numberFormatter setNumberStyle: NSNumberFormatterDecimalStyle];
NSString * isqft = [numberFormatter stringFromNumber:[NSNumber numberWithInt:sqftval] ];
sqft = [NSString stringWithFormat:@"%@", isqft];
cell.mSqftLabel.text = sqft;
[numberFormatter release];
}
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
[numberFormatter setNumberStyle: NSNumberFormatterCurrencyStyle];
NSString * pStr = [numberFormatter stringFromNumber:p.mPrice];
NSString * pStr1 =[pStr substringToIndex:[pStr length]- 3 ];
cell.mPriceLabel.text = pStr1;
[numberFormatter release];
NSString * cross = @"";
if( p.mCrossStreet != nil )
cross = [NSString stringWithFormat:@"%@", p.mCrossStreet];
cell.mCrossStLabel.text = cross;
if([p.mParkingTotal intValue] == 0)
{
cell.mParkingLabel.text = @"NA";
}
else
{
NSString * parkingStr = [NSString stringWithFormat:@"%d", [p.mParkingTotal intValue] ];
cell.mParkingLabel.text = parkingStr;
}
NSString * Notes = @"";
if( p.mRemarks != nil )
Notes = [NSString stringWithFormat:@"%@", p.mRemarks];
cell.c.editable = FALSE;
int len = [Notes length];
if ( len < 240)
{
cell.mNotes.text = Notes;
}
else
{
NSString * curString = [agentNotes substringToIndex:240];
curString = [curString stringByAppendingString:@"...."];
cell.mNotes.text= curString;
}
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.mID = p.mID;
return cell;
}