ios - Cell.selectedBackgroundview not showing -
cell.selectedbackgroundview isn't working. have figured out selectedview placed behind image in cell resulting in no visible image (i worked out making image small saw tick behind image). there way fix this? code seems fine must have layers
static nsstring *identifier = @"cell"; uicollectionviewcell *cell = [collectionview dequeuereusablecellwithreuseidentifier:identifier forindexpath:indexpath]; uiimageview *productimages = (uiimageview *)[cell viewwithtag:100]; productimages.image = [uiimage imagenamed:[allproducts_sections[indexpath.section]objectatindex:indexpath.row]]; collectionview.backgroundcolor = [uicolor greencolor]; cell.selectedbackgroundview = [[uiimageview alloc] initwithimage:[uiimage imagenamed:@"tick 1.png"]]; collectionview.allowsmultipleselection = yes; return cell
-(uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring * cellidentifier = @"cell"; uitableviewcell * cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell==nil) { cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier]; //some code } uiview *selectedbackview=[[uiview alloc]initwithframe:cell.bounds]; uiimageview *selectionimg = [[uiimageview alloc] initwithimage:[uiimage imagenamed:@"tick 1.png"]]; [selectedbackview addsubview:selectionimg]; cell.selectedbackgroundview=selectedbackview; return cell; }
also make sure tick 1.png in project's bundle.
Comments
Post a Comment