So ugly.
Test the phone iphone6s, that is, using the new feature 3DTouch. I don't know how hard I think it will be.
Before you start
// 签订这个协议
-(uitableviewcell *) TableView: (uitableview *) TableView Cellforrowatindexpath: ( nsindexpath *) indexpath{uitableviewcell * cell = [TableView dequeuereusablecellwithidentifier:@ "Cellid" ]; //specifies the proxy for each cell, which is roughly the meaning of [self registerforpreviewingwithdelegate:self Sourceview:cell]; // cell.textlabel .text = self [Indexpath.row ]; return Cell;}
#pragma mark-peek proxy method, tap to trigger pop-up VC- (Uiviewcontroller*) Previewingcontext: (ID<UIViewControllerPreviewing>) Previewingcontext viewcontrollerforlocation: (Cgpoint) location{//through [Previewingcontext Sourceview] to get the corresponding cell data; Nsindexpath*indexpath = [_tableview Indexpathforcell: (UITableViewCell*) [Previewingcontext Sourceview]];//VC for displaying previewsListviewcontroller *LISTVC = [[Listviewcontroller alloc] init];//demo is to pass in a string that may actually be the model you needListvc. StrText= [ Self. ArraydataObjectatindex:indexpath. Row];returnLISTVC;}#pragma mark-pop proxy method, where you can process the VC that will be entered- (void) Previewingcontext: (ID<UIViewControllerPreviewing>) Previewingcontext Commitviewcontroller: (Uiviewcontroller*) viewcontrollertocommit{}
In Listviewcontroller I use a label as a demo, you may also need to add a bottom menu (similar to favorites like this)
-(Nsarray<ID<UIPreviewActionItem>> *) Previewactionitems {uipreviewaction * action1 = [Uipreviewaction actionwithtitle:@"Favorites"Style1handler:^ (uipreviewaction * _nonnull action,Uiviewcontroller* _nonnull Previewviewcontroller) {NSLog(@"Favorites"); }]; Uipreviewaction * Action2 = [Uipreviewaction actionwithtitle:@"Loved it"Style0handler:^ (uipreviewaction * _nonnull action,Uiviewcontroller* _nonnull Previewviewcontroller) {NSLog(@"Loved it"); }];Nsarray*items = @[action1,action2];returnItems;}
IOS implementation Click to use 3D Touch in TableView