ios - How to prevent table cell border to be cut by cell image? -
i have table view , want add image on using following code,
first overriding layoutsubviews
- (void)layoutsubviews{ [super layoutsubviews]; self.imageview.frame = cgrectmake(15, 5, 50, 45); self.imageview.layer.cornerradius = 5.0f; self.imageview.layer.maskstobounds = yes; self.imageview.contentmode = uiviewcontentmodescaleaspectfill; }
and using in -(mytableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath
nsstring *imageurlstring = [userinforesponse[indexpath.row - beginindex] objectforkey:@"image_url"]; nsurl * imageurl = [nsurl urlwithstring:imageurlstring]; if ( [[nsuserdefaults standarduserdefaults] objectforkey:imageurlstring] == nil ) { [[nsuserdefaults standarduserdefaults] setobject:[nsdata datawithcontentsofurl:imageurl] forkey:imageurlstring]; } uiimage * img = [uiimage imagewithdata:[[nsuserdefaults standarduserdefaults] objectforkey:imageurlstring]]; cell.imageview.image = img; }
and in line added
- (cgfloat)tableview:(uitableview *)tableview heightforrowatindexpath:(nsindexpath *)indexpath { return 55.0; }
it works fine little problem (see attached image). don't want cell border line interrupted image.
i tried playing on codes wont help. knows answer? please help. thanks
note: works ios 6, screenshot on ios 7. can new settings ios 7 uitableview
?
go table view controller , put these codes viewdidload:
if (system_version_greater_than_or_equal_to(@"7.0")) //should check version prevent force closed { self.tableview.separatorinset = uiedgeinsetszero; }
Comments
Post a Comment