ios - UITableViewCell with a custom selectedBackgroundView that is wider than the master view controller on a UISplitViewController -
i have ipad app uisplitviewcontroller displayed on landscape. master controller uitableviewcontroller.
i want have selectedbackgroundview cells on uitableviewcontroller overflowing detail viewcontroller. this:
how can accomplish that?
if try set red arrow image (that 342px wide), gets resized 320px.
tried subclassing uiimageview , overriding setframe ignore calls try resize image, still no luck.
any ideas?
(updated on 2013-10-01 make work on ios7)
kudos user erway software helping me out.
here how got code work:
on uitableviewcontroller:
- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { // ... uitableviewcell *cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:@"someid"]; uiimage *image = [uiimage imagenamed:@"image_name"]; selectionimageview *imageview = [[selectionimageview alloc] initwithimage:image]; [cell setselectedbackgroundview:imageview]; [tableview setclipstobounds:no]; [[[cell contentview] superview] setclipstobounds:no]; // ... }
and here code selectionimageview:
@interface selectionimageview : uiimageview @end @implementation selectionimageview - (void)setframe:(cgrect)frame { // 342 width of image_name if (frame.size.width == 342.f) { [super setframe:frame]; } } @end
Comments
Post a Comment