|
|
@@ -20,11 +20,13 @@
|
|
|
#import "RAConvertor.h"
|
|
|
#import "RAUtils.h"
|
|
|
//#import "RTLabel.h"
|
|
|
+#import "ResultCell.h"
|
|
|
+#import <AudioToolbox/AudioToolbox.h>
|
|
|
|
|
|
|
|
|
const int delta = 25;
|
|
|
|
|
|
-@interface ResultViewController () <JLRefreshDelegate,QLPreviewControllerDataSource,QLPreviewControllerDelegate,UIViewControllerPreviewingDelegate>
|
|
|
+@interface ResultViewController () <JLRefreshDelegate,QLPreviewControllerDataSource,QLPreviewControllerDelegate,UIViewControllerPreviewingDelegate,ResultCellTouchDelegate>
|
|
|
|
|
|
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *w_constraint;
|
|
|
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *h_constraint;
|
|
|
@@ -105,6 +107,10 @@ const int delta = 25;
|
|
|
// self.tableview.tableHeaderView = [self get_tableHeader];
|
|
|
}
|
|
|
|
|
|
+- (void)viewWillAppear:(BOOL)animated {
|
|
|
+ [super viewWillAppear:animated];
|
|
|
+}
|
|
|
+
|
|
|
- (void)presses3DTouchForIndexPath:(NSIndexPath *)indexPath {
|
|
|
|
|
|
}
|
|
|
@@ -553,8 +559,8 @@ const int delta = 25;
|
|
|
|
|
|
{
|
|
|
NSString *CellIdentifier = @"tCell";
|
|
|
- UITableViewCell * cell= [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
|
|
|
-
|
|
|
+ ResultCell * cell= [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
|
|
|
+ cell.touchDelegate = self;
|
|
|
for(UIGestureRecognizer* g in cell.gestureRecognizers)
|
|
|
[ cell removeGestureRecognizer:g];
|
|
|
// cell gesture
|
|
|
@@ -578,13 +584,13 @@ const int delta = 25;
|
|
|
[cell addGestureRecognizer:cellDoubleTap];
|
|
|
|
|
|
// 3D Touch
|
|
|
- if (self.traitCollection.forceTouchCapability == UIForceTouchCapabilityAvailable) {
|
|
|
- DebugLog(@"3D Touch 可用!");
|
|
|
- //给cell注册3DTouch的peek(预览)和pop功能
|
|
|
- [self registerForPreviewingWithDelegate:self sourceView:cell];
|
|
|
- } else {
|
|
|
- DebugLog(@"3D Touch 无效");
|
|
|
- }
|
|
|
+// if (self.traitCollection.forceTouchCapability == UIForceTouchCapabilityAvailable) {
|
|
|
+// DebugLog(@"3D Touch 可用!");
|
|
|
+// //给cell注册3DTouch的peek(预览)和pop功能
|
|
|
+// [self registerForPreviewingWithDelegate:self sourceView:cell];
|
|
|
+// } else {
|
|
|
+// DebugLog(@"3D Touch 无效");
|
|
|
+// }
|
|
|
|
|
|
|
|
|
NSArray* arr_col=self.content_layout[@"header"][@"col"];
|
|
|
@@ -1126,7 +1132,7 @@ const int delta = 25;
|
|
|
// peek (预览)
|
|
|
- (UIViewController *)previewingContext:(id<UIViewControllerPreviewing>)previewingContext viewControllerForLocation:(CGPoint)location {
|
|
|
// [previewingContext sourceView]即为所按压的视图
|
|
|
- UITableViewCell *view = (UITableViewCell *)[previewingContext sourceView];
|
|
|
+// UITableViewCell *view = (UITableViewCell *)[previewingContext sourceView];
|
|
|
//
|
|
|
// // 设置不被虚化的范围
|
|
|
// CGRect rect = view.bounds;
|
|
|
@@ -1139,9 +1145,9 @@ const int delta = 25;
|
|
|
// tvc.preferredContentSize = CGSizeMake(0, 480); // 预览图的大小
|
|
|
//
|
|
|
// return tvc;
|
|
|
-
|
|
|
- NSIndexPath *indexPath = [self.tableview indexPathForCell:view];
|
|
|
- [self presses3DTouchForIndexPath:indexPath];
|
|
|
+
|
|
|
+// NSIndexPath *indexPath = [self.tableview indexPathForCell:view];
|
|
|
+// [self presses3DTouchForIndexPath:indexPath];
|
|
|
|
|
|
return nil;
|
|
|
}
|
|
|
@@ -1150,7 +1156,23 @@ const int delta = 25;
|
|
|
- (void)previewingContext:(id<UIViewControllerPreviewing>)previewingContext commitViewController:(UIViewController *)viewControllerToCommit {
|
|
|
|
|
|
// [self showViewController:viewControllerToCommit sender:self];
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
+#pragma mark - Cell Touch Delegate
|
|
|
+
|
|
|
+- (void)touchedCell:(ResultCell *)cell withForce:(float)force {
|
|
|
+
|
|
|
+ if (force > 4.0f) {
|
|
|
+ cell.handlingTouch = YES;
|
|
|
+ // 1519: 普通短震,3D Touch 中 Peek 震动反馈
|
|
|
+ // 1520: 普通短震,3D Touch 中 Pop 震动反馈
|
|
|
+ // 1521: 连续三次短震
|
|
|
+ // kSystemSoundID_Vibrate: 震动很暴力,不适合震动反馈
|
|
|
+ AudioServicesPlaySystemSound(1519); // 支持震动的设备上会震动,不支持就什么都不做 kSystemSoundID_Vibrate
|
|
|
+ NSIndexPath *indexPath = [self.tableview indexPathForCell:cell];
|
|
|
+ [self presses3DTouchForIndexPath:indexPath];
|
|
|
+ }
|
|
|
+ NSLog(@"force %f",force);
|
|
|
+}
|
|
|
@end
|