My app is scrolling and Searching very slow when I have Images set for each cell.Pictures lifted faster, but still slow when searching. Here is my code in the cell at row. Any ideas?
#interface UIImage (TPAdditions)
- (UIImage*)imageScaledToSize:(CGSize)size;
#end
#implementation UIImage (TPAdditions)
- (UIImage*)imageScaledToSize:(CGSize)size {
UIGraphicsBeginImageContext(size);
[self drawInRect:CGRectMake(0, 0, size.width, size.height)];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}
#end
cellForRowAtIndexPath
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = #"Cell";
static NSInteger buton1_tag = 100;
static NSInteger buton2_tag = 101;
if (indexPath.section == 0) {
CellIdentifier = #"CellMuzikEkle";
}else{
if(indexPath.row == 0 && !self.editing)
CellIdentifier = #"CellPlayereEkle";
else
CellIdentifier = #"CellDizi";
}
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
if (indexPath.section == 1 && indexPath.row == 0 && !self.editing) // Grubu ekle
cell = [[[NSBundle mainBundle] loadNibNamed:#"Cell4" owner:self options:nil] objectAtIndex:0];
else{
if (indexPath.section == 0) {
cell = [[[NSBundle mainBundle] loadNibNamed:#"Cell" owner:self options:nil] objectAtIndex:5];
UIButton *ipodbuton = (UIButton *) [cell.contentView viewWithTag:buton1_tag];
[ipodbuton addTarget:self action:#selector(iPoddan_Ekle:) forControlEvents:UIControlEventTouchUpInside];
UIButton *yuklenenler = (UIButton *) [cell.contentView viewWithTag:buton2_tag];
[yuklenenler addTarget:self action:#selector(Yuklenenlerden_Ekle:) forControlEvents:UIControlEventTouchUpInside];
}else{
cell.textLabel.font = [UIFont boldSystemFontOfSize:15.0];
cell.textLabel.numberOfLines=2;
cell.detailTextLabel.font = [UIFont systemFontOfSize:13];
[cell.imageView.layer setBorderWidth: 1.5];
}
}
}
if (indexPath.section == 1 && !self.editing && indexPath.row != 0)
cell.accessoryType =UITableViewCellAccessoryDetailDisclosureButton;
else
cell.accessoryType =UITableViewCellAccessoryNone;
if(indexPath.section == 0){
cell.textLabel.text = #"";
cell.detailTextLabel.text = #"";
cell.imageView.image = nil;
}else{
if (indexPath.row > 0 || self.editing) {
if (!self.editing)
indexPath = [NSIndexPath indexPathForRow:indexPath.row - 1 inSection:indexPath.section];
NSArray *aradizi = tableView == self.searchDisplayController.searchResultsTableView ? [[NSArray alloc] initWithArray:self.filteredListContent] : [[NSArray alloc] initWithArray:self.dizi];
if ([[NSUserDefaults standardUserDefaults] boolForKey:cellresimyuk_s])
cell.imageView.image = [[self Resim_Artwork:[aradizi objectAtIndex:indexPath.row]] imageScaledToSize:CGSizeMake(65, 50)];
else
cell.imageView.image = nil;
cell.textLabel.text = [[aradizi objectAtIndex:indexPath.row] objectForKey:isim_s];
NSTimeInterval theTimeInterval = [[[aradizi objectAtIndex:indexPath.row] objectForKey:sure_s] intValue] - 1;
NSDateFormatter* dateFormatter = [[NSDateFormatter alloc] init];
NSDate *date1;
if (theTimeInterval >= 3600) {
[dateFormatter setDateFormat:#"HH:mm:ss"];
date1 = [dateFormatter dateFromString:#"00:00:00"];
}else{
[dateFormatter setDateFormat:#"mm:ss"];
date1 = [dateFormatter dateFromString:#"00:00"];
}
NSDate *date2 = [[NSDate alloc] initWithTimeInterval:theTimeInterval sinceDate:date1];
cell.detailTextLabel.text = [dateFormatter stringFromDate:date2];
}else{
if (tableView == self.searchDisplayController.searchResultsTableView)
cell.textLabel.text = AramaSonuclrPlayerEkle_lclz;
else
cell.textLabel.text = GrubuPlayereEkle_lclz;
}
}
return cell;
}
Resim_Artwork
- (UIImage *)Resim_Artwork:(NSDictionary *)dictr{
if ([dictr objectForKey:videoid_s]) {
if ([self Dosya_Varmi:[[rsm_favori stringByAppendingPathComponent:[dictr objectForKey:videoid_s]] stringByAppendingPathExtension:#"png"]])
return [UIImage imageWithContentsOfFile:[[rsm_favori stringByAppendingPathComponent:[dictr objectForKey:videoid_s]] stringByAppendingPathExtension:#"png"]];
}else{
if ([[[dictr objectForKey:urlsi_s] pathExtension] isEqualToString:#"mp4"]) {
AVURLAsset *assetresim = [[AVURLAsset alloc] initWithURL:[NSURL fileURLWithPath:[kDocdir stringByAppendingPathComponent:[dictr objectForKey:urlsi_s]]] options:nil];
AVAssetImageGenerator *gen = [[AVAssetImageGenerator alloc] initWithAsset:assetresim];
gen.appliesPreferredTrackTransform = YES;
int suresi = CMTimeGetSeconds(assetresim.duration);
if (suresi > 0) {
CMTime time;
if (suresi>6)
time = CMTimeMakeWithSeconds(6.0, 600);
else
time = CMTimeMakeWithSeconds(0.0, 600);
NSError *error = nil;
CMTime actualTime;
CGImageRef image = [gen copyCGImageAtTime:time actualTime:&actualTime error:&error];
UIImage *thumb = [[UIImage alloc] initWithCGImage:image];
CGImageRelease(image);
return thumb;
}
}else {
if ([dictr objectForKey:kaynak_s]) {
AVAsset *asset = [AVURLAsset URLAssetWithURL:[NSURL URLWithString:[dictr objectForKey:urlsi_s]] options:nil];
for ( AVMetadataItem* item in [asset commonMetadata] ) {
if ([[item commonKey] isEqualToString:#"artwork"] )
if (item.dataValue != nil)
if ([UIImage imageWithData:item.dataValue])
return [UIImage imageWithData:item.dataValue];
}
}else{
if ([self Dosya_Varmi:[kDocdir stringByAppendingPathComponent:[dictr objectForKey:urlsi_s]]]){
AVAsset *asset = [AVURLAsset URLAssetWithURL:[NSURL fileURLWithPath:[kDocdir stringByAppendingPathComponent:[dictr objectForKey:urlsi_s]]] options:nil];
for ( AVMetadataItem* item in [asset commonMetadata] ) {
if ([[item commonKey] isEqualToString:#"artwork"] )
if (item.dataValue != nil)
if ([UIImage imageWithData:item.dataValue])
return [UIImage imageWithData:item.dataValue];
}
}
}
}
}
return [self Resimm:#".varsayilan" Koordinat:CGRectMake(120,1320, 80, 60) retinami:0 grubu:6];
}
tableView willDisplayCell
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
NSArray *viewControllers = [self.tabBarController viewControllers];
NSArray *viewControllers2 = [[viewControllers objectAtIndex:0] viewControllers];
Player *detailViewController = (Player *)[viewControllers2 objectAtIndex:0];
[detailViewController.temalar Cell_Tema:cell];
cell.textLabel.backgroundColor = [UIColor clearColor];
cell.detailTextLabel.backgroundColor = [UIColor clearColor];
cell.textLabel.textColor = [detailViewController.temalar Baslik_Renk];
cell.detailTextLabel.textColor = [detailViewController.temalar Bilgi_Renk];
[cell.imageView.layer setBorderColor: [tableView.separatorColor CGColor]];
[((UIButton *) [cell.contentView viewWithTag:100]) setBackgroundImage:[self Resimm:#".buton" Koordinat:CGRectMake(0,1350, 94, 35) retinami:0 grubu:7] forState:UIControlStateNormal];
[((UIButton *) [cell.contentView viewWithTag:100]) setTitleColor:[detailViewController.temalar Baslik_Renk] forState:UIControlStateNormal];
[((UIButton *) [cell.contentView viewWithTag:101]) setBackgroundImage:[self Resimm:#".buton" Koordinat:CGRectMake(0,1350, 94, 35) retinami:0 grubu:7] forState:UIControlStateNormal];
[((UIButton *) [cell.contentView viewWithTag:101]) setTitleColor:[detailViewController.temalar Baslik_Renk] forState:UIControlStateNormal];
}
Here:
NSArray *aradizi = tableView == self.searchDisplayController.searchResultsTableView ?
[[NSArray alloc] initWithArray:self.filteredListContent] :
[[NSArray alloc] initWithArray:self.dizi];
You should avoid creating objects inside cellForRowAtIndexPath wherever possible.
Anyway you don't need to:
NSArray *aradizi = tableView == self.searchDisplayController.searchResultsTableView ?
self.filteredListContent :
self.dizi;
Here you seem to be creating and resizing thumbnails on the fly. :
if ([[NSUserDefaults standardUserDefaults] boolForKey:cellresimyuk_s])
cell.imageView.image = [[self Resim_Artwork:[aradizi objectAtIndex:indexPath.row]]
imageScaledToSize:CGSizeMake(65, 50)];
This is bound to jam up smooth tableView scolling. All of these should be pre-processed and cached, or at least only processed once here and cached for reuse.
Time-consuming nonUI processing like this can go onto another thread so that your scolling stays smooth even if the image isn't ready to show. Something likeā¦
if ([[NSUserDefaults standardUserDefaults] boolForKey:cellresimyuk_s])
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
UIImage* image =
[[self Resim_Artwork:[aradizi objectAtIndex:indexPath.row]]
imageScaledToSize:CGSizeMake(65, 50)];
dispatch_async(dispatch_get_main_queue(), ^{
//check our cell is still valid
if ([[self.tableView cellForRowAtIndexPath:indexPath] isEqual:cell]){
cell.imageView.image = image;
}
});
});
else
cell.imageView.image = nil;
Regarding the date formatter: these are heavyweight objects, you need to ensure to only create once, keep in a property for reuse. I suggest you do the following:
Declare two date formatter properties and another for your zero'd date. Initialise them all in viewDidLoad:
- (void)viewDidLoad {
[super viewDidLoad];
self.hoursFormat = [[NSDateFormatter alloc] init];
[self.hoursFormat setDateFormat:#"HH:mm:ss"];
self.minsFormat = [[NSDateFormatter alloc]init];
[self.minsFormat setDateFormat:#"mm:ss"];
self.zeroDate = [self.hoursFormat dateFromString:#"00:00:00"];
}
Then in cellForRowAtIndexPath:
NSDate* date = [self.zeroDate dateByAddingTimeInterval:theTimeInterval];
if (theTimeInterval >= 3600) {
self.label.text = [self.hoursFormat stringFromDate:date];
} else {
self.label.text = [self.minsFormat stringFromDate:date];
}
He Was, Thank you for the answer. performance was very nice. But since I made this change, the program closes.
new codes:
NSMutableArray *aradizi;
if (tableView == self.searchDisplayController.searchResultsTableView)
aradizi = self.filteredListContent;
if (indexPath.section == 2 && tableView != self.searchDisplayController.searchResultsTableView)
aradizi = self.dizi_klasorler;
if (indexPath.section == 3)
aradizi = self.dizi_veriler;
if ([[NSUserDefaults standardUserDefaults] boolForKey:cellresimyuk_s]){
if (cell.imageView.image == nil)
cell.imageView.image = [[self Resimm:#".varsayilan" Koordinat:CGRectMake(120,1320, 80, 60) retinami:0 grubu:6] Resim_Skala:CGSizeMake(60, 45)];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
UIImage* image = [[self Resim_Artwork:[[aradizi objectAtIndex:indexPath.row] objectForKey:urlsi_s]] Resim_Skala:CGSizeMake(60, 45)];
dispatch_async(dispatch_get_main_queue(), ^{
//check our cell is still valid
if (tableView == self.searchDisplayController.searchResultsTableView){
if ([[self.searchDisplayController.searchResultsTableView cellForRowAtIndexPath:indexPath] isEqual:cell])
cell.imageView.image = image;
}else{
if ([[self.tableView cellForRowAtIndexPath:indexPath] isEqual:cell])
cell.imageView.image = image;
}
});
});
}else
cell.imageView.image = nil;
http://img29.imageshack.us/img29/1083/ekranresmi2013020301553.png
http://img502.imageshack.us/img502/5591/ekranresmi2013012919525.png
Related
Due to some permission issue, in my tableView some cell can be selected by user and some cell can't be selected by that user. What I did in my cellForRowAtIndexPath is:
-(UITableViewCell *) tableView:(UITableView *) tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
int row = (int)[indexPath row];
static NSString *simpleTableIdentifier = #"EditProjectTableCell";
Project* project = (Project*)[self.projectList objectAtIndex:row];
EditProjectTableCell *cell = (EditProjectTableCell *)[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil) {
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:simpleTableIdentifier owner:self options:nil];
cell = [nib objectAtIndex:0];
cell.serial.layer.cornerRadius = 5;
cell.accessoryView = [[ UIImageView alloc ] initWithImage:[UIImage imageNamed:#"accessory_right.png"]];
cell.cellView.backgroundColor = [UIColor blackColor];
cell.backgroundColor = [UIColor blackColor];
}
if ([project.role isEqualToString:#"1"] || [project.role isEqualToString:#"2"]) {
UIView *customView = [[UIView alloc] initWithFrame:cell.frame];
customView.backgroundColor = [UIColor clearColor];
cell.selectedBackgroundView = customView;
}
else cell.selectionStyle = UITableViewCellSelectionStyleNone;
if(cell.imageFetchOperation != nil) [cell.imageFetchOperation cancel];
cell.imageFetchOperation = [[CellBlockOperation alloc] initWithIndexPath:indexPath
andPkId:project.pkId
andFetchImage:YES
andFetchReportCounter:NO
andFetchIssueCounter:NO
andFetchDrawingCounter:NO
andDelegate:self];
if(cell.counterFetchOperation != nil) [cell.counterFetchOperation cancel];
cell.counterFetchOperation = [[CellBlockOperation alloc] initWithIndexPath:indexPath
andPkId:project.pkId
andFetchImage:NO
andFetchReportCounter:YES
andFetchIssueCounter:NO
andFetchDrawingCounter:NO
andDelegate:self];
cell.projectName.text = project.name;
cell.projectNumber.text = project.number;
cell.owner.text = [NSString stringWithFormat:#"%# %#",project.ownerName,project.ownerLastName];
NSString* temp_date = [Utils stringFromDateForGUI:project.creationDate];
cell.date.text = temp_date;
[cell.syncStatusView setImage:[Utils getImageForSyncStatus:project.isDirty.intValue]];
NSNumber *ret = [self.reportCountList objectForKey:project.pkId];
if(ret == nil) {
cell.serial.text = #"";
[cell.counterFetchOperation setPkId:project.pkId];
[self.tableCellUpdateQueue addOperation:cell.counterFetchOperation];
} else {
cell.serial.text = [NSString stringWithFormat:#"%d",[ret intValue]];
}
id img = [self getSmallImage:project.pkId andIndexPath:indexPath andCell:cell];
if(img == nil || img == (id)[NSNull null]) {
img = [UIImage imageNamed:#"gray-img.jpg"];
cell.iconImageView.image = [UIImage imageNamed:#"project-icon.png"];
cell.iconImageView.hidden = NO;
} else {
cell.iconImageView.hidden = YES;
}
cell.imageView.image = (UIImage*)img;
if ([project.role isEqualToString:#"2"] || [project.role isEqualToString:#"1"])
cell.selectImageView.hidden = NO;
else
cell.selectImageView.hidden = YES;
return cell;
}
Selection part is working just fine. But if a cell is selected then the background color of a UILabel gets changed to clear color. See the below images for clear idea.
Before selection:
After Selection :
Scrolling through the table is somewhat a bit choppy and stutters when scrolling.
Is there any improvements i can make to make it smooth?
here's my cellForRowAtIndexPath
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath object:(PFObject *)object {
UITableViewCell *cellEmpty;
if ([tableView isEqual:self.categoryTableView]) {
NSString *CellIdentifierCategory = #"categoryCell";
UITableViewCell *categoryCell = [self.categoryTableView dequeueReusableCellWithIdentifier:CellIdentifierCategory];
if (categoryCell == nil) {
categoryCell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifierCategory];
}
else{
categoryCell.textLabel.text = [_categoryTableArray objectAtIndex:indexPath.row];
return categoryCell;
}
}
if ([tableView isEqual:self.tableView]) {
if (indexPath.section == self.objects.count) {
UITableViewCell *cell = [self tableView:tableView cellForNextPageAtIndexPath:indexPath];
UILabel *loadLabel = (UILabel *)[cell viewWithTag:1];
if (!self.isLoading) {
loadLabel.text = #"The End of Space";
self.tableView.tableFooterView = nil;
}
cell.userInteractionEnabled = NO;
return cell;
}
NSString *CellIdentifier = #"PhotoCell";
InterestsCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[InterestsCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}
else{
PFUser *user = [object objectForKey:#"userTookPhoto"];
dispatch_async(dispatch_get_main_queue(), ^{
cell.companyLogo.layer.cornerRadius = cell.companyLogo.frame.size.width / 2;
cell.companyLogo.clipsToBounds = YES;
});
[cell.productImageView setUserInteractionEnabled:YES];
[cell.priceLabel setUserInteractionEnabled:YES];
UITapGestureRecognizer *tapForImage = [[UITapGestureRecognizer alloc] initWithTarget:self action:#selector(handleProductImageTap:)];
tapForImage.cancelsTouchesInView = YES;
tapForImage.numberOfTapsRequired = 1;
[cell.productImageView addGestureRecognizer:tapForImage];
UITapGestureRecognizer *tapForPrice = [[UITapGestureRecognizer alloc] initWithTarget:self action:#selector(handleProductImageTap:)];
tapForPrice.cancelsTouchesInView = YES;
tapForPrice.numberOfTapsRequired = 1;
[cell.priceLabel addGestureRecognizer:tapForPrice];
cell.productImageView.tag = indexPath.section;
cell.productImageView.file = (PFFile *)object[#"image"];
[cell.productImageView loadInBackground:^(UIImage * _Nullable image, NSError * _Nullable error) {
} progressBlock:^(int percentDone) {
NSLog(#"float value: %f",percentDone * 0.01);
dispatch_async(dispatch_get_main_queue(), ^{
[cell.progressView setProgress:percentDone * 0.01 animated:YES];
});
if (percentDone == 100) {
[cell.progressView setHidden:YES];
}
}];
dispatch_async(dispatch_get_main_queue(), ^{
cell.productTitle.text = object[#"titleOfPhoto"];
});
[cell.companyLogo setUserInteractionEnabled:YES];
UITapGestureRecognizer *tapGesture1 = [[UITapGestureRecognizer alloc] initWithTarget:self action:#selector(segueCompanyProfile)];
tapGesture1.numberOfTapsRequired = 1;
[cell.companyLogo addGestureRecognizer:tapGesture1];
if (user[#"profileImage"]) {
cell.companyLogo.file = (PFFile *)user[#"profileImage"];
[cell.companyLogo loadInBackground];
}
else{
dispatch_async(dispatch_get_main_queue(), ^{
UIImage *image = [UIImage imageNamed:#"defaultBrandLogo.png"];
cell.companyLogo.image = image;
});
}
dispatch_async(dispatch_get_main_queue(), ^{
[cell.companyLabelButton setTitle:user.username forState:UIControlStateNormal];
cell.companyLabelButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
cell.companyLabelButton.contentEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 0);
});
[cell.companyLabelButton addTarget:self action:#selector(segueCompanyProfile) forControlEvents:UIControlEventTouchUpInside];
NSNumber *price = object[#"PriceOfPhoto"];
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
[numberFormatter setNumberStyle: NSNumberFormatterCurrencyStyle];
NSString *numberAsString = [numberFormatter stringFromNumber:price];
NSString *priceLabelText = [NSString stringWithFormat:#"%#",numberAsString];
dispatch_async(dispatch_get_main_queue(), ^{
cell.priceLabel.text = priceLabelText;
});
// UIView *line = [[UIView alloc] initWithFrame:CGRectMake(0, cell.productTitle.frame.origin.y + cell.productTitle.frame.size.height + 10, self.view.frame.size.width - 30, 2)];
// line.backgroundColor = [UIColor groupTableViewBackgroundColor];
// [cell.cardView addSubview:line];
cell.likeButtonOutlet.delegate = self;
cell.likeButtonOutlet.sectionIndex = indexPath.section;
NSArray *likesArray = object[#"likesBy"];
if (likesArray.count > 0) {
NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
NSString *groupingSeparator = [[NSLocale currentLocale] objectForKey:NSLocaleGroupingSeparator];
[formatter setGroupingSeparator:groupingSeparator];
[formatter setGroupingSize:3];
[formatter setAlwaysShowsDecimalSeparator:NO];
[formatter setUsesGroupingSeparator:YES];
NSString *formattedString = [formatter stringFromNumber:[NSNumber numberWithFloat:likesArray.count]];
dispatch_async(dispatch_get_main_queue(), ^{
cell.likeCountLabel.text = formattedString;
});
}
else{
dispatch_async(dispatch_get_main_queue(), ^{
cell.likeCountLabel.text = nil;
});
}
if (likesArray.count > 0) {
for (NSString *likes in likesArray) {
if ([likes isEqualToString:[PFUser currentUser].objectId]) {
dispatch_async(dispatch_get_main_queue(), ^{
[cell.likeButtonOutlet setSelected:YES];
});
}
else{
dispatch_async(dispatch_get_main_queue(), ^{
[cell.likeButtonOutlet setSelected:NO];
});
}
}
}
else{
dispatch_async(dispatch_get_main_queue(), ^{
[cell.likeButtonOutlet setSelected:NO];
});
}
}
return cell;
}
return cellEmpty;
}
am getting the following error while scrolling the UITableview.
EXC_BAD_ACCESS, -[CFString retain]: message sent to deallocated instance
how can i find the deallocated instance...?
this my noOfRowsinsection code
for(int i=0;i<size;i++)
{
NSString *CellIdentifier1;
if(universalApp==2)
{
NSAutoreleasePool *pool=[[NSAutoreleasePool alloc]init];
CellIdentifier1 = #"CustomThumbImageTableCell_iphone";
cell = [[[CustomThumbImageTableCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier1] autorelease];
//NSLog(#">>>>> Creating image >>>>>>>>");
//cell.thumbImageView = [[CustomImageView alloc] initWithFrame:CGRectMake(4, 4, 83, 101)];
cell.thumbImageView = [[[CustomImageView alloc] initWithFrame:CGRectMake(4, 4, 83, 101)] autorelease];
[imgViewArray addObject:cell.thumbImageView];
[cell.thumbImageView release];
[pool release];
}
and this my cellforRow code
enter code hereif(universalApp==2)
{
NSLog(#"iphone cell>>>>>>>>>>>>>>>>>>>>>>");
CustomThumbImageTableCell *cell = nil;
#try
{
static NSString *CellIdentifier = #"CustomThumbImageTableCell_iphone";
int currentRow = [indexPath row] ;//+ skippedItems;
//NSLog(#">>>>>>>>>>>>Current Table row = %d, %d, %d", loadedCellArray.count, currentRow, [Table numberOfRowsInSection:0]);
/*if(loadedCellArray.count > currentRow + 1 && [loadedCellArray objectAtIndex:(currentRow)] != nil)
{
NSLog(#"Image updated = %d", ( currentRow));
cell = (CustomThumbImageTableCell_iphone *) [loadedCellArray objectAtIndex:(currentRow )];
}
else
{*/
/*if(loadedCellArray.count > currentRow + 1 )// && [loadedCellArray objectAtIndex:(currentRow)] != nil)
// if( [loadedCellArray objectAtIndex:(currentRow)] != nil)
{
//NSLog(#"Image updated = %d", ( currentRow));
cell = (CustomThumbImageTableCell_iphone *) [loadedCellArray objectAtIndex:([indexPath row] )];
if(!isScrollingUp)
{
//scrollCount++;
[loadedCellArray removeLastObject];
}
isScrollingUp = YES;
}
else*/
{
static NSString *CellIdentifier = #"CustomThumbImageTableCell_iphone";
static NSString *CellIdentifier1 = #"CustomThumbImageTableCell_iphone";
//UITableViewCell *cell;
if(cell==nil)
{
cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
cell = [[[CustomThumbImageTableCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
}
else
{
cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier1];
cell = [[[CustomThumbImageTableCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier1] autorelease];
}
cell.selectionStyle = UITableViewCellSelectionStyleNone;
NSLog(#">>>>>>>>>..... %d, %d, %#", imgViewArray.count, indexPath.row, (((int)imgViewArray.count- 1) < (int)indexPath.row) ? #"YES" : #"NO");
/*if(((int)imgViewArray.count- 1) < (int)indexPath.row)
{
// NSLog(#">>>>> Creating image >>>>>>>>");
cell.thumbImageView = [[CustomImageView alloc] initWithFrame:CGRectMake(4, 4, 83, 101)];
[imgViewArray addObject:cell.thumbImageView];
}
else {
cell.thumbImageView = (CustomImageView *) [imgViewArray objectAtIndex:indexPath.row];
}*/
//NSLog(#"img array = %#,%d",imgViewArray,imgViewArray.count);
cell.thumbImageView =[imgViewArray objectAtIndex:indexPath.row];
cell.thumbImageView.contentMode = UIViewContentModeScaleAspectFit;
[cell.contentView addSubview:cell.thumbImageView];
cell.thumbImageView.index = (int)indexPath.row;
#try
{
{
BOOL isFound = NO;
do
{
#try {
NSArray *array1 = [contentString componentsSeparatedByString:#"###"];
NSArray *array2 = [[array1 objectAtIndex:currentRow ] componentsSeparatedByString:#"##"];
NSString *str = [NSString stringWithFormat:#"%#", [array2 objectAtIndex:0]];
str = [str stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
UILabel *name = [[UILabel alloc] initWithFrame:CGRectMake(104, 6, 141, 96)];
name.textAlignment = UITextAlignmentCenter;
name.font = [UIFont fontWithName:#"Arial" size:17.0];
name.numberOfLines = 3;
name.backgroundColor = [UIColor clearColor];
name.textColor = [UIColor whiteColor];
cell.catalogName = name;
[cell.catalogName setText:[NSString stringWithFormat:#"%#", str]];
[cell.contentView addSubview:cell.catalogName];
//[name release];
name = [[UILabel alloc] initWithFrame:CGRectMake(107, 89, 193, 21)];//107,89,193
name.textAlignment = UITextAlignmentCenter;
name.font = [UIFont fontWithName:#"Arial" size:13.0];
name.textColor = [UIColor whiteColor];
name.numberOfLines = 3;
name.backgroundColor = [UIColor clearColor];
name.alpha = 0.26;
cell.pageNo = name;
[cell.contentView addSubview:cell.pageNo];
//[name release];
if((searchId != 2 && (isLineNameSearchEnabled == 0)) || searchInCatalogFlag == 1)
//cell Page No//pageNoLabel
//NSLog(#"cell for row.......");
[cell.pageNo setText:[NSString stringWithFormat:#"Page No: %#", [array2 objectAtIndex:(array2.count - 2)]]];
{
}
NSLog(#" thumb image = %#",[NSString stringWithFormat:#"%#%#", baseURL, [array2 objectAtIndex:1]]);
//[cell.thumbImageView setImageURL:#"http://www.zoomcatalog.com/sites/default/files/catalogs/27705_Abex2010/images/thumbnails/Thumb-1.jpg"];
[cell.thumbImageView setImageURL:[NSString stringWithFormat:#"%#%#", baseURL, [array2 objectAtIndex:1]]];
[NSThread detachNewThreadSelector:#selector(initThread) toTarget:cell.thumbImageView withObject:nil];
[cell.thumbImageView setPageNo:((searchId == 2 || (isLineNameSearchEnabled && searchInCatalogFlag == 0)) ? 0 : (int)currentRow)];
UIImageView *img = [[UIImageView alloc] initWithFrame:CGRectMake(264, 33, 36, 34)];
img.contentMode = UIViewContentModeScaleToFill;
[img setImage:cellArrow];
[cell.contentView addSubview:img];
[img release];
[cell.catalogName release];
//>>>> [cell.pageNoLabel release];
[cell.thumbImageView release];
isFound = YES;
}
#catch (NSException * e) {
//skippedItems++;
currentRow = [indexPath row] + 1;
}
}
while (!isFound);
/*if(isScrollingUp)
{
//scrollCount++;
[loadedCellArray removeLastObject];
}
isScrollingUp = NO;
currentRow =indexPath.row;
// cell = (CustomThumbImageTableCell_iphone *) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
//cell = (CustomThumbImageTableCell_iphone *) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:#"CustomThumbImageTableCell_iphone" owner:self options:nil];
//cell = (CustomThumbImageTableCell_iphone *) [loadedCellArray objectAtIndex:(currentRow )];
cell = self.cell;
self.cell = nil;
}
NSLog(#"Image loaded from source= %d,", ( currentRow));
//if(loadedCellArray.count > currentRow + 1)
// NSLog(#"Image loaded from source cell array ref= %#", [loadedCellArray objectAtIndex:(currentRow)]);
/*if(currentRow == ([Table numberOfRowsInSection:0] - 1))
{
cell.catalogName.text = #"50 More";
NSLog(#">>>>>>>>>>>>>>>>>>>>> End cell....");
return cell;
}
/////
// if(true)
// return cell;
#try
{
{
BOOL isFound = NO;
do
{
#try {
NSArray *array1 = [contentString componentsSeparatedByString:#"###"];
NSArray *array2 = [[array1 objectAtIndex:currentRow] componentsSeparatedByString:#"##"];
NSString *str = [NSString stringWithFormat:#"%#", [array2 objectAtIndex:0]];
str = [str stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
// NSLog(#"&&&&&&&&&&&&&&&&& %#", str);
[cell.catalogName setText:[NSString stringWithFormat:#"%#", str]];
if((searchId != 2 && (isLineNameSearchEnabled == 0)) || searchInCatalogFlag == 1)
[cell.pageNo setText:[NSString stringWithFormat:#"Page No: %#", [array2 objectAtIndex:(array2.count - 2)]]];
// NSLog(#"Background color has been set....%d", i);
//NSLog(#")
//NSLog(#"Catalog %d = %#", currentRow, [array1 objectAtIndex:currentRow]);
// NSLog(#"Image URL = %#", [NSString stringWithFormat:#"%#%#", baseURL, [array2 objectAtIndex:1]]);
[cell.thumbImageView setImageURL:[NSString stringWithFormat:#"%#%#", baseURL, [array2 objectAtIndex:1]]];
//[cell.thumbImageView setContentString:contentString];
//if(searchId == 2)
// [cell.thumbImageView setContentString:[NSString stringWithFormat:#"%#", [array2 objectAtIndex:(array2.count - (isLineNameSearch ? 2 : 2))]]];
[cell.thumbImageView performSelectorOnMainThread:#selector(initThread) withObject:nil waitUntilDone:NO];
[cell.thumbImageView setPageNo:(searchId == 2 ? #"0" : [indexPath row])];
isFound = YES;
}
#catch (NSException * e) {
//skippedItems++;
currentRow = [indexPath row] + 1;
}
*/
// }
// while(!isFound);// && currentRow < [Table numberOfRowsInSection:0]);
//[imgViewArray addObject:cell.thumbImageView];
// [imgViewArray retain];
//[label setTextColor:[UIColor blackColor]];
//[label setTextAlignment:UITextAlignmentCenter];
/* UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(7 + ((i % 3) * (96 + 8)) , 9 + ((i / 3) * (140 + 10)), 98, 142)];
[label setBackgroundColor:[UIColor grayColor]];
[scrollView addSubview:label];
[imgViewArray addObject:imgView];
[scrollView addSubview:imgView];
if(i % 3 == 0)
{
[scrollView setContentSize:CGSizeMake(scrollView.contentSize.width, scrollView.contentSize.height + (140 + 10))];
}*/
}
//[imgViewArray retain];
// [cellArray retain];
}
When you have memory management issues, there are a number of things you can do:
Re-read the Cocoa memory management rules and make sure that you're following them.
Run the static analyser. This will often pick up places where you have neglected the memory management rules.
Since it appears that you have already enabled NSZombies, insert a breakpoint for [_NSZombie release]. This should hopefully break on the line that is causing the problem.
Edit:
Based on your code, the following line could be the culprit.
[cell.thumbImageView release]; // NOT GOOD
Similarly in your other code you have:
[cell.thumbImageView release]; // NOT GOOD
[cell.catalogName release]; // NOT GOOD
You set an autoreleased object to the thumbImageView and catalogName property of the cell, but you are still trying to release it. This is not how Cocoa memory management works. You don't own cell.thumbImageView or cell.catalogName, so you should not release them.
This problem occurs when you are trying to access the deallocated object. May be your string get released before you accessing it.
I have been trying to figure out if my cells are overlapping but I failed. My table contains 3 entries - the first 2 get overlapped but the 3rd one doesn't. I have searched on the net and found that variables should be defined locally. I have taken that advice but sadly, it didn't help.
Below is the code:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UIColor *rung;
if (indexPath.row%2 == 0) {
// 0.662745 0.662745 0.662745
rung=[UIColor colorWithRed:0.802745 green:0.802745 blue:0.802745 alpha:1];
color=NO;
}
else {
// 0.972549 0.972549 1
//0.411765 0.411765 0.411765
rung=[UIColor colorWithRed:0.862745 green:0.862745 blue:0.862745 alpha:1];
color=YES;
}
//static NSString *MyIdentifier = #"Identifier";
NSLog(#"====IndexPath is %d",indexPath.row);
ChatSlideDC *slide = [[HMMainManager getSharedInstance].currentMeeting.resumedChatMessages objectAtIndex:indexPath.section];
ChatMessageDC *message;
message = [[slide ChatMessageArray]objectAtIndex:indexPath.row];
NSLog(#"%i",indexPath.row);
NSLog(#"%#",message.senderEmail);
NSLog(#"====Message Type is %#",message.MessageType);
//--storing Email-ID for Pics
UIImage *avatar;
if(message.AttendeeID)
{
avatar= [(AppDelegate *)[[UIApplication sharedApplication]delegate] getAvatar:message.AttendeeID andAttendeEmail:message.senderEmail];
}
//
NSLog(#"%#",message.Message);
if ([message.MessageType isEqualToString: #"0"] || [message.MessageType isEqualToString:#"1"]) {
ChatCustomCell * cell = (ChatCustomCell *) [tableView dequeueReusableCellWithIdentifier:#"ChatCustomCell"];
if (cell == nil) {
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:#"ChatCustomCell" owner:self options:nil];
cell = (ChatCustomCell*)[nib objectAtIndex:0];
}
// cell.backgroundImage.backgroundColor=rung;
UIView *view = [[UIView alloc] initWithFrame:CGRectZero];
view.backgroundColor = rung;
view.opaque = YES;
cell.backgroundView = view;
[view release];
//cell.backgroundColor=rung;
cell.lblSaid.text =#"Said";
cell.lblName.text =message.SenderName;
cell.lblText.text =message.Message;
NSLog(#"manager strID: %# chat cell attendeeID %#",[HMMainManager getSharedInstance].currentMeeting.strAttendeeID,message.AttendeeID);
NSLog(#"%# == %#",message.AttendeeID,[HMMainManager getSharedInstance].currentMeeting.strAttendeeID);
[cell.imgThumbUserPic setImage:[UIImage imageNamed:#"updateProfileIco.png"]];
// if ([message.AttendeeID isEqualToString:[HMMainManager getSharedInstance].currentMeeting.strAttendeeID]) {
// cell.imgThumbUserPic.image = [MainManager getSharedInstance].userManager.userImage;
cell.imgThumbUserPic.image = avatar;
// }
cell.selectionStyle = UITableViewCellEditingStyleNone;
// [message release];
return cell;
}
if ([message.MessageType isEqualToString:#"2"] || [message.MessageType isEqualToString:#"3"] ) {
if ([message.MessageType isEqualToString:#"3"] || (message.question && [message.question length]>0)) {
//show asnwer cell
// AnswerCustomCell * cell = (AnswerCustomCell *) [tableView dequeueReusableCellWithIdentifier:#"AnswerCustomCell"];
NSMutableArray *answerquestArray= [[[HMMainManager getSharedInstance] currentMeeting]questionAnswerArray];
// UITableViewCell *newCell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:#"abc"];
int width=300,height=164,totalHeight;;
// AnswerMultipleCell * cell;
int questionIndex;
QuestionWithAnswers *qwa;
for (int i=0;i<answerquestArray.count;i++) {
qwa=[answerquestArray objectAtIndex:i];
NSLog(#"");
if ([qwa.questionID isEqualToString:message.QuestionID]) {
break;
}
}//end for
// newCell.frame=CGRectMake(0, totalHeight, width, height);
ChatMessageDC *answersInArr;
int i=0;
for (i=0;i<[qwa.answersMArray count];i++) {
answersInArr=[qwa.answersMArray objectAtIndex:i];
if([answersInArr.MessageId isEqualToString:message.MessageId])
{
break;
}
}
AnswerMultipleCell * cell = (AnswerMultipleCell *) [tableView dequeueReusableCellWithIdentifier:#"AnswerMultipleCell"];
if (cell == nil)
{
// NSArray *nib = [[NSBundle mainBundle] loadNibNamed:#"AnswerCustomCell" owner:self options:nil];
// cell = (AnswerCustomCell*)[nib objectAtIndex:0];
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:#"AnswerMultipleCell" owner:self options:nil];
cell = (AnswerMultipleCell*)[nib objectAtIndex:0];
}
UIView *view = [[UIView alloc] initWithFrame:CGRectZero];
view.backgroundColor = rung;
view.opaque = YES;
cell.backgroundView = view;
[view release];
//answer here goes
cell.answerTxt.text=answersInArr.Message;
cell.userName.text=answersInArr.SenderName;
[cell.answerTxt flashScrollIndicators];
//question
NSLog(#"%#",message.MessageId);
NSLog(#"manager strID: %# ans cell attendeeID %#",[HMMainManager getSharedInstance].currentMeeting.strAttendeeID,message.AttendeeID);
[cell.userPic setImage:[UIImage imageNamed:#"updateProfileIco.png" ]];
// [cell.quePic setImage:[UIImage imageNamed:#"updateProfileIco.png" ]];
//if ([message.AttendeeID isEqualToString:[HMMainManager getSharedInstance].currentMeeting.strAttendeeID]) {
avatar= [(AppDelegate *)[[UIApplication sharedApplication]delegate] getAvatar:[qwa.attendeIDMArray objectAtIndex:i] andAttendeEmail:[qwa.attendeEmails objectAtIndex:i]];
NSLog(#"----------:: %# == %# and message:%#",message.AttendeeID ,[HMMainManager getSharedInstance].currentMeeting.strAttendeeID,message.Message);
// cell.ansPic.image = [MainManager getSharedInstance].userManager.userImage;
cell.userPic.image = avatar;
// }
NSLog(#"manager strID: %# ans cell attendeeID %#",[HMMainManager getSharedInstance].currentMeeting.strAttendeeID,message.QuestionID);
// {
NSLog(#"------------:: %# == %# and message:%#",message.questionAttendeeID ,[HMMainManager getSharedInstance].currentMeeting.strAttendeeID,message.Message);
// cell.quePic.image = [MainManager getSharedInstance].userManager.userImage;
// cell.quePic.image = avatar;
// }
//}//end answersArray
return cell;
}
else {
//show question cell
QuestionCustomCell * cell = (QuestionCustomCell *) [tableView dequeueReusableCellWithIdentifier:#"QuestionCustomCell"];
if (cell == nil) {
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:#"QuestionCustomCell" owner:self options:nil];
cell = (QuestionCustomCell*)[nib objectAtIndex:0];
}
UIView *view = [[UIView alloc] initWithFrame:CGRectZero];
view.backgroundColor = rung;
view.opaque = YES;
cell.backgroundView = view;
[view release];
cell.lblSaid.text =#"Asked";
cell.lblName.text =message.SenderName;
NSLog(#"Question is %#", message.question);
cell.lblText.text =message.Message;
[cell.lblText flashScrollIndicators];
// cell.lblAnswerQuestion.hidden = NO;
if (!message.answered) {
cell.lblAnswerQuestion.hidden = NO;
cell.userInteractionEnabled = YES;
}else {
cell.lblAnswerQuestion.hidden = YES;
cell.userInteractionEnabled = NO;
}
// cell.userInteractionEnabled = YES;
[[HMMainManager getSharedInstance].currentMeeting.questionDict setObject:message.AttendeeID forKey:message.MessageId];
NSLog(#"manager strID: %# ques cell attendeeID %#",[HMMainManager getSharedInstance].currentMeeting.strAttendeeID,message.AttendeeID);
[cell.imgThumbUserPic setImage:[UIImage imageNamed:#"updateProfileIco.png"]];
// if ([message.AttendeeID isEqualToString:[HMMainManager getSharedInstance].currentMeeting.strAttendeeID]) {
// cell.imgThumbUserPic.image = [MainManager getSharedInstance].userManager.userImage;
cell.imgThumbUserPic.image = avatar;
// }
cell.tvAnswer.delegate = self;
NSMutableString* finalSec = [NSString stringWithFormat:#"%d",indexPath.section];
for (NSInteger x=0; x<3; x++) {
if (finalSec.length <3) {
finalSec = [NSString stringWithFormat:#"0%#",finalSec];
}
}
NSLog(#"%#", finalSec);
NSString* tag = [NSString stringWithFormat:#"%d%#",indexPath.row+1, finalSec];
NSLog(#"tag value %d",[tag intValue]);
cell.btnAnswer.tag = [tag intValue];//indexPath.row + 1000 + indexPath.section;
cell.tvAnswer.tag = [tag intValue];
cell.selectionStyle = UITableViewCellEditingStyleNone;
[cell.btnAnswer addTarget:self action:#selector(answerButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
// [message release];
return cell;
}
}
// [message release];
return nil;
}
If you have custom (non 44 point height) cells, then you need to implement - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
I am building a sectioned table, and it is showing up with what looks to be a section on top of a section. You can see on the image that there is a white line under each section.
The image
Here is the code I have to build the table:
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return [alertList count];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 1;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier;
if (self.interfaceOrientation == UIInterfaceOrientationLandscapeLeft || self.interfaceOrientation == UIInterfaceOrientationLandscapeRight)
{
CellIdentifier = #"CellLandscape";
}
else
{
CellIdentifier = #"Cell";
}
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleSubtitle
reuseIdentifier:CellIdentifier]
autorelease];
//cell.contentView.backgroundColor = [UIColor blackColor];
CGRect frame;
if (self.interfaceOrientation == UIInterfaceOrientationLandscapeLeft || self.interfaceOrientation == UIInterfaceOrientationLandscapeRight)
{
frame.origin.x = 370;
//titleFrame.size.width = 320;
}
else
{
frame.origin.x = 220;
//titleFrame.size.width = 220;
}
frame.origin.y = 5;
frame.size.height = 15;
frame.size.width = 74;
UILabel *instLabel = [[UILabel alloc] initWithFrame:frame];
instLabel.tag = 1;
[cell.contentView addSubview:instLabel];
[instLabel release];
}
// Configure the cell.
Alert *p = [alertList objectAtIndex:indexPath.section];
UILabel *instLabel = (UILabel *) [cell.contentView viewWithTag:1];
instLabel.text = [p docDate];
instLabel.textColor = [UIColor blackColor];
[instLabel setFont:[UIFont fontWithName:#"Arial" size:12]];
NSString *path;
if ([[p subscription] isEqual:#"Y"])
{
path = [[NSBundle mainBundle] pathForResource:#"watchlist_on" ofType:#"png"];
}
else
{
path = [[NSBundle mainBundle] pathForResource:#"watchlist_off" ofType:#"png"];
}
//NSLog(#"%#", path);
cell.textLabel.textColor = [UIColor colorWithRed:.847 green:0 blue: 0 alpha: 1];
[cell.textLabel setFont:[UIFont boldSystemFontOfSize:13]];
cell.textLabel.text = [[NSString alloc] initWithFormat:#"%#", [p Name]];
cell.detailTextLabel.textColor = [UIColor blackColor];
[cell.detailTextLabel setFont:[UIFont fontWithName:#"Arial" size: 10]];
cell.detailTextLabel.text = [p docTitle];
cell.detailTextLabel.textColor = [UIColor blackColor];
[cell.detailTextLabel setFont:[UIFont fontWithName:#"Arial" size: 10]];
//cell.detailTextLabel.text = [p docDate];
//cell.imageView.image = [UIImage imageWithContentsOfFile:path];
cell.imageView.userInteractionEnabled = YES;
cell.imageView.userInteractionEnabled = YES;
//cell.imageView.image = [UIImage imageWithContentsOfFile:path];
/// [cell addSubview:imgView];
//cell.textLabel.text = [[NSString alloc] initWithFormat:#"%#, %# G: %#\nDOB: %# Inst: %#", [p lastName], [p firstName], [p gender],
// [p birthDate], [p inst]];
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
//only 1 alert at a time
//make doc list from alert object
Document *documentList1 = [[Document alloc] init];
self.documentList = documentList1;
[documentList1 setTitle:[p docTitle]];
[documentList1 setUniqueId:[p uniqueId]];
[documentList1 setDate:[p docDate]];
[documentList1 setRepoOID:[p repoOid]];
[documentArray addObject:documentList];
return cell;
}
Change the table view's separator style to either single line or none - you probably have it on single line etched.