iphone - UIImageView shadow not being drawn first time cell is visible -
i have uicollectionview customcell has uiimageview i'm adding shadow to. however, shadow not being drawn before cell has been "outside" visible collection view , comes (uicollection)view.
-(uicollectionviewcell *)collectionview:(uicollectionview *)collectionview cellforitematindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"genrecell"; genreviewcell *cell = [collectionview dequeuereusablecellwithreuseidentifier:cellidentifier forindexpath:indexpath]; cell.genreimageview.layer.shadowradius = 1.5; cell.genreimageview.layer.shadowoffset = cgsizemake(-1, -1); cell.genreimageview.layer.shadowopacity = 0.5; cell.genreimageview.layer.shadowcolor = [uicolor blackcolor].cgcolor; cell.genreimageview.layer.shadowpath = [uibezierpath bezierpathwithrect:cell.genreimageview.bounds].cgpath; return cell; }
is there reason setting shadowpath property? since want set shadow bounds of image view itself, shouldn't have that. remove line.
also, prevent lag:
cell.genreimageview.layer.shouldrasterize = yes; cell.genreimageview.layer.rasterizationscale = [[uiscreen mainscreen] scale];
Comments
Post a Comment