Редактировать ----- Я сделал тот же код на английской записи. Скорость прокрутки осталась высокой, как обычно, и работает нормально, но когда я получаю арабские данные, прокрутка снова замедляется.это проблема с арабскими данными ???
У меня есть записи около 100, и моя прокрутка таблицы очень медленная.Может кто-нибудь сказать мне, что не так с этим кодом, и почему я получаю медленную прокрутку?
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
GreetingAppDelegate *appdelegate = (GreetingAppDelegate *)[[UIApplication sharedApplication]delegate];
DBSetter *product = (DBSetter *)[appdelegate.myrecords objectAtIndex:indexPath.row];
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
cell.textLabel.font=[UIFont fontWithName:@"Arial" size:16.0];
}
CGRect a=CGRectMake(8, 0, 307, 59);
UIImageView *aImg=[[UIImageView alloc] initWithFrame:a];
UIImageView *bImg=[[UIImageView alloc] initWithFrame:a];
//if(indexPath.row%2==0)
aImg.image=[UIImage imageNamed:@"cell-arrow.png"];
//else {
// aImg.image=[UIImage imageNamed:@"CellHighlight.png"];
//}
bImg.image=[UIImage imageNamed:@"cell-arrow-h.png"];
[aImg setContentMode:UIViewContentModeScaleToFill];
[bImg setContentMode:UIViewContentModeScaleToFill];
cell.backgroundView=aImg;
cell.selectedBackgroundView=bImg;
[aImg release];
[bImg release];
NSString *tempStr=[NSString stringWithFormat:@"%@",product.tempdesc];
//int stringlength=[tempStr length];
//[[tempStr stringByReplacingOccurrencesOfString:@"<Dear User>" withString:@" "] substringWithRange:NSMakeRange(0, 20)];
//if (stringlength >20) {
//cell.textLabel.text = [NSString stringWithFormat:@"%@...", [[tempStr stringByReplacingOccurrencesOfString:@"<Dear user>" withString:@""] substringWithRange:NSMakeRange(0, 30)]];
//}
//else {
cell.textLabel.text = tempStr;
//}
if(appdelegate.lang==2)
{
[cell setTextAlignment:UITextAlignmentRight];
aImg.transform = CGAffineTransformMakeScale(-1, 1);
bImg.transform = CGAffineTransformMakeScale(-1, 1);
}
return cell;
}