├── .gitignore ├── Classes ├── JXMovableCellTableView.h └── JXMovableCellTableView.m ├── JXMovableCellTableView.podspec ├── JXMovableCellTableView.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── xcuserdata │ └── jiaxin.xcuserdatad │ └── xcschemes │ ├── JXMovableCellTableView.xcscheme │ └── xcschememanagement.plist ├── JXMovableCellTableView ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Gifs │ ├── Breath.gif │ ├── EdgeScroll.gif │ └── NeonLight.gif ├── Info.plist ├── JXTableViewCell.h ├── JXTableViewCell.m ├── JXTableViewCell.xib ├── ViewController.h ├── ViewController.m └── main.m ├── JXMovableCellTableViewTests ├── Info.plist └── JXMovableCellTableViewTests.m ├── JXMovableCellTableViewUITests ├── Info.plist └── JXMovableCellTableViewUITests.m ├── LICENSE ├── Package.swift └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata 19 | 20 | ## Other 21 | *.xccheckout 22 | *.moved-aside 23 | *.xcuserstate 24 | *.xcscmblueprint 25 | 26 | ## Obj-C/Swift specific 27 | *.hmap 28 | *.ipa 29 | .swiftpm/* 30 | 31 | # CocoaPods 32 | # 33 | # We recommend against adding the Pods directory to your .gitignore. However 34 | # you should judge for yourself, the pros and cons are mentioned at: 35 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 36 | # 37 | # Pods/ 38 | 39 | # Carthage 40 | # 41 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 42 | # Carthage/Checkouts 43 | 44 | Carthage/Build 45 | 46 | # fastlane 47 | # 48 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 49 | # screenshots whenever they are needed. 50 | # For more information about the recommended setup visit: 51 | # https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md 52 | 53 | fastlane/report.xml 54 | fastlane/screenshots 55 | JXMovableCellTableView.xcodeproj/project.xcworkspace/xcuserdata/jiaxin.xcuserdatad/UserInterfaceState.xcuserstate 56 | -------------------------------------------------------------------------------- /Classes/JXMovableCellTableView.h: -------------------------------------------------------------------------------- 1 | // 2 | // JXMovableCellTableView.h 3 | // JXMovableCellTableView 4 | // 5 | // Created by jiaxin on 16/2/15. 6 | // Copyright © 2016年 jiaxin. All rights reserved. 7 | // 8 | 9 | #import 10 | @class JXMovableCellTableView; 11 | 12 | @protocol JXMovableCellTableViewDataSource 13 | 14 | @required 15 | /** 16 | * Get the data source array of the tableView, each time you start the call to get the latest data source. 17 | * The array in the data source must be a mutable array, otherwise it cannot be exchanged 18 | * The format of the data source:@[@[sectionOneArray].mutableCopy, @[sectionTwoArray].mutableCopy, ....].mutableCopy 19 | * Even if there is only one section, the outermost layer needs to be wrapped in an array, such as:@[@[sectionOneArray].mutableCopy].mutableCopy 20 | * 数据源约束: 多组数组嵌套且为可变数组 21 | */ 22 | - (NSMutableArray *)dataSourceArrayInTableView:(JXMovableCellTableView *)tableView; 23 | 24 | @optional 25 | ///返回自定义截图的部分 26 | - (UIView *)snapshotViewWithCell:(UITableViewCell *)cell; 27 | 28 | @end 29 | 30 | @protocol JXMovableCellTableViewDelegate 31 | @optional 32 | /** 33 | * The cell that will start moving the indexPath location 34 | * 长按拖拽cell将要开始移动 35 | */ 36 | - (void)tableView:(JXMovableCellTableView *)tableView willMoveCellAtIndexPath:(NSIndexPath *)indexPath; 37 | /** 38 | * Move cell `fromIndexPath` to `toIndexPath` completed 39 | * 移动cell换了位置下标 40 | */ 41 | - (void)tableView:(JXMovableCellTableView *)tableView didMoveCellFromIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath; 42 | /** 43 | * Move cell ended 44 | * 移动cell结束 45 | */ 46 | - (void)tableView:(JXMovableCellTableView *)tableView endMoveCellAtIndexPath:(NSIndexPath *)indexPath; 47 | 48 | /** 49 | * The user tries to move a cell that is not allowed to move. You can make some prompts to inform the user. 50 | * 尝试长按拖拽不能移动的cell 这个代理方法可以加个toast或者其他处理 与设置`canHintWhenCannotMove`不冲突 51 | */ 52 | - (void)tableView:(JXMovableCellTableView *)tableView tryMoveUnmovableCellAtIndexPath:(NSIndexPath *)indexPath; 53 | 54 | /** 55 | * Customize the screenshot style of the movable cell 56 | * 自定义移动的cell截图的样式 加阴影啥的 57 | */ 58 | - (void)tableView:(JXMovableCellTableView *)tableView customizeMovalbeCell:(UIImageView *)movableCellsnapshot; 59 | 60 | /** 61 | * Custom start moving cell animation 62 | * 自定义cell拖拽移动的动画 63 | */ 64 | - (void)tableView:(JXMovableCellTableView *)tableView customizeStartMovingAnimation:(UIImageView *)movableCellsnapshot fingerPoint:(CGPoint)fingerPoint; 65 | 66 | @end 67 | 68 | @interface JXMovableCellTableView : UITableView 69 | 70 | @property (nonatomic, weak) id dataSource; 71 | @property (nonatomic, weak) id delegate; 72 | @property (nonatomic, strong, readonly) UILongPressGestureRecognizer *longPressGesture; 73 | /** 74 | * Whether to allow dragging to the edge of the screen, turn on edge scrolling, default YES 75 | * 是否允许拖动到屏幕边缘,启用边缘滚动,默认为YES 76 | */ 77 | @property (nonatomic, assign) BOOL canEdgeScroll; 78 | 79 | /** 80 | * Edge scroll trigger range, default 150, the faster the edge is closer to the edge 81 | * 边缘滚动触发范围,默认为150,越靠近边缘滚得越快 82 | */ 83 | @property (nonatomic, assign) CGFloat edgeScrollTriggerRange; 84 | 85 | /** 86 | * When the CADisplayLink callback, self.contentOffsetY can scroll max speed, default 20. the faster the edge closer 87 | * 当CADisplayLink回调时,self.contentOffsetY可以滚动的最大速度,默认为20 帧/s。 88 | */ 89 | @property (nonatomic, assign) CGFloat maxScrollSpeedPerFrame; 90 | 91 | 92 | /// 当cell不允许被移动的时候,长按时是否提示。默认为YES。 93 | @property (nonatomic, assign) BOOL canHintWhenCannotMove; 94 | 95 | /// 是否允许震动反馈。默认为NO。 96 | @property (nonatomic, assign) BOOL canFeedback NS_AVAILABLE_IOS(10_0); 97 | 98 | @end 99 | -------------------------------------------------------------------------------- /Classes/JXMovableCellTableView.m: -------------------------------------------------------------------------------- 1 | // 2 | // JXMovableCellTableView.m 3 | // JXMovableCellTableView 4 | // 5 | // Created by jiaxin on 16/2/15. 6 | // Copyright © 2016年 jiaxin. All rights reserved. 7 | // 8 | 9 | #import "JXMovableCellTableView.h" 10 | 11 | static NSTimeInterval kJXMovableCellAnimationTime = 0.25; 12 | 13 | @interface JXMovableCellTableView () 14 | @property (nonatomic, strong) UILongPressGestureRecognizer *longPressGesture; 15 | @property (nonatomic, assign) CGFloat gestureMinimumPressDuration; 16 | @property (nonatomic, strong) NSIndexPath *selectedIndexPath; 17 | @property (nonatomic, strong) UIImageView *snapshot; 18 | @property (nonatomic, strong) NSMutableArray *tempDataSource; 19 | @property (nonatomic, strong) CADisplayLink *edgeScrollLink; 20 | @property (nonatomic, assign) CGFloat currentScrollSpeedPerFrame; 21 | @property (nonatomic, strong) UIImpactFeedbackGenerator *generator NS_AVAILABLE_IOS(10_0); 22 | 23 | @end 24 | 25 | @implementation JXMovableCellTableView 26 | 27 | @dynamic dataSource, delegate; 28 | 29 | - (void)dealloc 30 | { 31 | self.dataSource = nil; 32 | self.delegate = nil; 33 | } 34 | 35 | - (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style 36 | { 37 | self = [super initWithFrame:frame style:style]; 38 | if (self) { 39 | self.rowHeight = 0; 40 | self.estimatedRowHeight = 0; 41 | self.estimatedSectionHeaderHeight = 0; 42 | self.estimatedSectionFooterHeight = 0; 43 | if (@available(iOS 10.0, *)) { 44 | self.generator = [[UIImpactFeedbackGenerator alloc] initWithStyle:UIImpactFeedbackStyleLight]; 45 | } 46 | [self jx_initData]; 47 | [self jx_addGesture]; 48 | } 49 | return self; 50 | } 51 | 52 | - (instancetype)initWithCoder:(NSCoder *)aDecoder 53 | { 54 | self = [super initWithCoder:aDecoder]; 55 | if (self) { 56 | [self jx_initData]; 57 | [self jx_addGesture]; 58 | } 59 | return self; 60 | } 61 | 62 | - (void)willMoveToSuperview:(UIView *)newSuperview { 63 | if (newSuperview == nil) { 64 | [self jx_stopEdgeScroll]; 65 | } 66 | } 67 | 68 | - (void)jx_initData 69 | { 70 | _gestureMinimumPressDuration = 1.f; 71 | _canEdgeScroll = YES; 72 | _edgeScrollTriggerRange = 150.f; 73 | _maxScrollSpeedPerFrame = 20; 74 | _canHintWhenCannotMove = YES; 75 | _canFeedback = NO; 76 | } 77 | 78 | #pragma mark Gesture 79 | 80 | - (void)jx_addGesture 81 | { 82 | _longPressGesture = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(jx_processGesture:)]; 83 | _longPressGesture.minimumPressDuration = _gestureMinimumPressDuration; 84 | [self addGestureRecognizer:_longPressGesture]; 85 | } 86 | 87 | - (void)jx_processGesture:(UILongPressGestureRecognizer *)gesture 88 | { 89 | switch (gesture.state) { 90 | case UIGestureRecognizerStateBegan: 91 | { 92 | [self jx_gestureBegan:gesture]; 93 | } 94 | break; 95 | case UIGestureRecognizerStateChanged: 96 | { 97 | if (!_canEdgeScroll) { 98 | [self jx_gestureChanged:gesture]; 99 | } 100 | } 101 | break; 102 | case UIGestureRecognizerStateEnded: 103 | case UIGestureRecognizerStateCancelled: 104 | { 105 | [self jx_gestureEndedOrCancelled:gesture]; 106 | } 107 | break; 108 | default: 109 | break; 110 | } 111 | } 112 | 113 | - (void)jx_gestureBegan:(UILongPressGestureRecognizer *)gesture 114 | { 115 | CGPoint point = [gesture locationInView:gesture.view]; 116 | NSIndexPath *selectedIndexPath = [self indexPathForRowAtPoint:point]; 117 | if (!selectedIndexPath) { 118 | return; 119 | } 120 | UITableViewCell *cell = [self cellForRowAtIndexPath:selectedIndexPath]; 121 | if (self.dataSource && [self.dataSource respondsToSelector:@selector(tableView:canMoveRowAtIndexPath:)]) { 122 | if (![self.dataSource tableView:self canMoveRowAtIndexPath:selectedIndexPath]) { 123 | //It is not allowed to move the cell, then shake it to prompt the user. 124 | if (self.canHintWhenCannotMove) { 125 | CAKeyframeAnimation *shakeAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform.translation.x"]; 126 | shakeAnimation.duration = 0.25; 127 | shakeAnimation.values = @[@(-20), @(20), @(-10), @(10), @(0)]; 128 | [cell.layer addAnimation:shakeAnimation forKey:@"shake"]; 129 | } 130 | 131 | if (self.delegate && [self.delegate respondsToSelector:@selector(tableView:tryMoveUnmovableCellAtIndexPath:)]) { 132 | [self.delegate tableView:self tryMoveUnmovableCellAtIndexPath:selectedIndexPath]; 133 | } 134 | return; 135 | } 136 | } 137 | 138 | if (self.delegate && [self.delegate respondsToSelector:@selector(tableView:willMoveCellAtIndexPath:)]) { 139 | [self.delegate tableView:self willMoveCellAtIndexPath:selectedIndexPath]; 140 | } 141 | if (_canEdgeScroll) { 142 | [self jx_startEdgeScroll]; 143 | } 144 | //Get a data source every time you move 145 | if (self.dataSource && [self.dataSource respondsToSelector:@selector(dataSourceArrayInTableView:)]) { 146 | _tempDataSource = [self.dataSource dataSourceArrayInTableView:self]; 147 | } 148 | _selectedIndexPath = selectedIndexPath; 149 | 150 | if (@available(iOS 10.0, *)) { 151 | if (self.canFeedback) { 152 | [self.generator prepare]; 153 | [self.generator impactOccurred]; 154 | } 155 | } 156 | 157 | if (self.dataSource && [self.dataSource respondsToSelector:@selector(snapshotViewWithCell:)]) { 158 | UIView *snapView = [self.dataSource snapshotViewWithCell:cell]; 159 | _snapshot = [self jx_snapshotViewWithInputView:snapView]; 160 | }else{ 161 | _snapshot = [self jx_snapshotViewWithInputView:cell]; 162 | } 163 | 164 | if (self.delegate && [self.delegate respondsToSelector:@selector(tableView:customizeMovalbeCell:)]) { 165 | [self.delegate tableView:self customizeMovalbeCell:_snapshot]; 166 | }else { 167 | _snapshot.layer.shadowColor = [UIColor grayColor].CGColor; 168 | _snapshot.layer.masksToBounds = NO; 169 | _snapshot.layer.cornerRadius = 0; 170 | _snapshot.layer.shadowOffset = CGSizeMake(-5, 0); 171 | _snapshot.layer.shadowOpacity = 0.4; 172 | _snapshot.layer.shadowRadius = 5; 173 | } 174 | 175 | _snapshot.frame = CGRectMake((cell.frame.size.width - _snapshot.frame.size.width)/2.0f, cell.frame.origin.y + (cell.frame.size.height - _snapshot.frame.size.height)/2.0, _snapshot.frame.size.width, _snapshot.frame.size.height); 176 | [self addSubview:_snapshot]; 177 | 178 | cell.hidden = YES; 179 | if (self.delegate && [self.delegate respondsToSelector:@selector(tableView:customizeStartMovingAnimation:fingerPoint:)]) { 180 | [self.delegate tableView:self customizeStartMovingAnimation:_snapshot fingerPoint:point]; 181 | }else { 182 | [UIView animateWithDuration:kJXMovableCellAnimationTime animations:^{ 183 | self.snapshot.center = CGPointMake(_snapshot.center.x, point.y); 184 | }]; 185 | } 186 | } 187 | 188 | - (void)jx_gestureChanged:(UILongPressGestureRecognizer *)gesture 189 | { 190 | CGPoint point = [gesture locationInView:gesture.view]; 191 | point = CGPointMake(_snapshot.center.x, [self limitSnapshotCenterY:point.y]); 192 | //Let the screenshot follow the gesture 193 | _snapshot.center = point; 194 | 195 | NSIndexPath *currentIndexPath = [self indexPathForRowAtPoint:point]; 196 | if (!currentIndexPath) { 197 | return; 198 | } 199 | UITableViewCell *selectedCell = [self cellForRowAtIndexPath:_selectedIndexPath]; 200 | selectedCell.hidden = YES; 201 | 202 | if (self.dataSource && [self.dataSource respondsToSelector:@selector(tableView:canMoveRowAtIndexPath:)]) { 203 | if (![self.dataSource tableView:self canMoveRowAtIndexPath:currentIndexPath]) { 204 | return; 205 | } 206 | } 207 | 208 | if (currentIndexPath && ![_selectedIndexPath isEqual:currentIndexPath]) { 209 | //Exchange data source and cell 210 | [self jx_updateDataSourceAndCellFromIndexPath:_selectedIndexPath toIndexPath:currentIndexPath]; 211 | if (self.delegate && [self.delegate respondsToSelector:@selector(tableView:didMoveCellFromIndexPath:toIndexPath:)]) { 212 | [self.delegate tableView:self didMoveCellFromIndexPath:_selectedIndexPath toIndexPath:currentIndexPath]; 213 | } 214 | _selectedIndexPath = currentIndexPath; 215 | } 216 | } 217 | 218 | - (void)jx_gestureEndedOrCancelled:(UILongPressGestureRecognizer *)gesture 219 | { 220 | if (_canEdgeScroll) { 221 | [self jx_stopEdgeScroll]; 222 | } 223 | if (self.delegate && [self.delegate respondsToSelector:@selector(tableView:endMoveCellAtIndexPath:)]) { 224 | [self.delegate tableView:self endMoveCellAtIndexPath:_selectedIndexPath]; 225 | } 226 | UITableViewCell *cell = [self cellForRowAtIndexPath:_selectedIndexPath]; 227 | [UIView animateWithDuration:kJXMovableCellAnimationTime animations:^{ 228 | self.snapshot.transform = CGAffineTransformIdentity; 229 | self.snapshot.frame = CGRectMake((cell.frame.size.width - _snapshot.frame.size.width)/2.0f, cell.frame.origin.y + (cell.frame.size.height - _snapshot.frame.size.height)/2.0, _snapshot.frame.size.width, _snapshot.frame.size.height); 230 | } completion:^(BOOL finished) { 231 | cell.hidden = NO; 232 | [self.snapshot removeFromSuperview]; 233 | self.snapshot = nil; 234 | }]; 235 | } 236 | 237 | #pragma mark Private action 238 | 239 | - (UIImageView *)jx_snapshotViewWithInputView:(UIView *)inputView 240 | { 241 | UIGraphicsBeginImageContextWithOptions(inputView.bounds.size, NO, 0); 242 | [inputView.layer renderInContext:UIGraphicsGetCurrentContext()]; 243 | UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); 244 | UIGraphicsEndImageContext(); 245 | UIImageView *snapshot = [[UIImageView alloc] initWithImage:image]; 246 | return snapshot; 247 | } 248 | 249 | - (void)jx_updateDataSourceAndCellFromIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath{ 250 | if (@available(iOS 10.0, *)) { 251 | if (self.canFeedback) { 252 | [self.generator prepare]; 253 | [self.generator impactOccurred]; 254 | } 255 | } 256 | 257 | if ([self numberOfSections] == 1) { 258 | //only one section 259 | [_tempDataSource[fromIndexPath.section] exchangeObjectAtIndex:fromIndexPath.row withObjectAtIndex:toIndexPath.row]; 260 | [self moveRowAtIndexPath:fromIndexPath toIndexPath:toIndexPath]; 261 | }else { 262 | //multiple sections 263 | id fromData = _tempDataSource[fromIndexPath.section][fromIndexPath.row]; 264 | id toData = _tempDataSource[toIndexPath.section][toIndexPath.row]; 265 | NSMutableArray *fromArray = _tempDataSource[fromIndexPath.section]; 266 | NSMutableArray *toArray = _tempDataSource[toIndexPath.section]; 267 | [fromArray replaceObjectAtIndex:fromIndexPath.row withObject:toData]; 268 | [toArray replaceObjectAtIndex:toIndexPath.row withObject:fromData]; 269 | [_tempDataSource replaceObjectAtIndex:toIndexPath.section withObject:toArray]; 270 | 271 | 272 | if (@available(iOS 11.0, *)) { 273 | if (_currentScrollSpeedPerFrame > 10) { 274 | [self reloadRowsAtIndexPaths:@[fromIndexPath, toIndexPath] withRowAnimation:UITableViewRowAnimationNone]; 275 | }else { 276 | [self beginUpdates]; 277 | [self moveRowAtIndexPath:toIndexPath toIndexPath:fromIndexPath]; 278 | [self moveRowAtIndexPath:fromIndexPath toIndexPath:toIndexPath]; 279 | [self endUpdates]; 280 | } 281 | }else { 282 | [self beginUpdates]; 283 | [self moveRowAtIndexPath:toIndexPath toIndexPath:fromIndexPath]; 284 | [self moveRowAtIndexPath:fromIndexPath toIndexPath:toIndexPath]; 285 | [self endUpdates]; 286 | } 287 | } 288 | } 289 | 290 | - (CGFloat)limitSnapshotCenterY:(CGFloat)targetY 291 | { 292 | CGFloat minValue = _snapshot.bounds.size.height/2.0 + self.contentOffset.y; 293 | CGFloat maxValue = self.contentOffset.y + self.bounds.size.height - _snapshot.bounds.size.height/2.0; 294 | return MIN(maxValue, MAX(minValue, targetY)); 295 | } 296 | 297 | - (CGFloat)limitContentOffsetY:(CGFloat)targetOffsetY { 298 | CGFloat minContentOffsetY; 299 | if (@available(iOS 11.0, *)) { 300 | minContentOffsetY = -self.adjustedContentInset.top; 301 | } else { 302 | minContentOffsetY = -self.contentInset.top; 303 | } 304 | 305 | CGFloat maxContentOffsetY = minContentOffsetY; 306 | CGFloat contentSizeHeight = self.contentSize.height; 307 | if (@available(iOS 11.0, *)) { 308 | contentSizeHeight += self.adjustedContentInset.top + self.adjustedContentInset.bottom; 309 | } else { 310 | contentSizeHeight += self.contentInset.top + self.contentInset.bottom; 311 | } 312 | if (contentSizeHeight > self.bounds.size.height) { 313 | maxContentOffsetY += contentSizeHeight - self.bounds.size.height; 314 | } 315 | return MIN(maxContentOffsetY, MAX(minContentOffsetY, targetOffsetY)); 316 | } 317 | 318 | #pragma mark EdgeScroll 319 | 320 | - (void)jx_startEdgeScroll 321 | { 322 | _edgeScrollLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(jx_processEdgeScroll)]; 323 | [_edgeScrollLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSRunLoopCommonModes]; 324 | } 325 | 326 | - (void)jx_processEdgeScroll 327 | { 328 | CGFloat minOffsetY = self.contentOffset.y + _edgeScrollTriggerRange; 329 | CGFloat maxOffsetY = self.contentOffset.y + self.bounds.size.height - _edgeScrollTriggerRange; 330 | CGPoint touchPoint = _snapshot.center; 331 | 332 | if (touchPoint.y < minOffsetY) { 333 | //Cell is moving up 334 | CGFloat moveDistance = (minOffsetY - touchPoint.y)/_edgeScrollTriggerRange*_maxScrollSpeedPerFrame; 335 | _currentScrollSpeedPerFrame = moveDistance; 336 | self.contentOffset = CGPointMake(self.contentOffset.x, [self limitContentOffsetY:self.contentOffset.y - moveDistance]); 337 | }else if (touchPoint.y > maxOffsetY) { 338 | //Cell is moving down 339 | CGFloat moveDistance = (touchPoint.y - maxOffsetY)/_edgeScrollTriggerRange*_maxScrollSpeedPerFrame; 340 | _currentScrollSpeedPerFrame = moveDistance; 341 | self.contentOffset = CGPointMake(self.contentOffset.x, [self limitContentOffsetY:self.contentOffset.y + moveDistance]); 342 | } 343 | [self setNeedsLayout]; 344 | [self layoutIfNeeded]; 345 | 346 | [self jx_gestureChanged:_longPressGesture]; 347 | } 348 | 349 | - (void)jx_stopEdgeScroll 350 | { 351 | _currentScrollSpeedPerFrame = 0; 352 | if (_edgeScrollLink) { 353 | [_edgeScrollLink invalidate]; 354 | _edgeScrollLink = nil; 355 | } 356 | } 357 | 358 | @end 359 | -------------------------------------------------------------------------------- /JXMovableCellTableView.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod spec lint JXCategoryView.podspec' to ensure this is a 3 | # valid spec and to remove all comments including this before submitting the spec. 4 | # 5 | # To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html 6 | # To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/ 7 | # 8 | 9 | Pod::Spec.new do |s| 10 | 11 | # ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 12 | # 13 | # These will help people to find your library, and whilst it 14 | # can feel like a chore to fill in it's definitely to your advantage. The 15 | # summary should be tweet-length, and the description more in depth. 16 | # 17 | 18 | s.name = "JXMovableCellTableView" 19 | s.version = "0.0.3" 20 | s.summary = "The custom tableView which can start moving the cell with a long press gesture. " 21 | 22 | # This description is used to generate tags and improve search results. 23 | # * Think: What does it do? Why did you write it? What is the focus? 24 | # * Try to keep it short, snappy and to the point. 25 | # * Write the description between the DESC delimiters below. 26 | # * Finally, don't worry about the indent, CocoaPods strips it! 27 | 28 | s.homepage = "https://github.com/pujiaxin33/JXMovableCellTableView" 29 | # s.screenshots = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif" 30 | 31 | 32 | # ――― Spec License ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 33 | # 34 | # Licensing your code is important. See http://choosealicense.com for more info. 35 | # CocoaPods will detect a license file if there is a named LICENSE* 36 | # Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'. 37 | # 38 | 39 | s.license = "MIT" 40 | # s.license = { :type => "MIT", :file => "FILE_LICENSE" } 41 | 42 | 43 | # ――― Author Metadata ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 44 | # 45 | # Specify the authors of the library, with email addresses. Email addresses 46 | # of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also 47 | # accepts just a name if you'd rather not provide an email address. 48 | # 49 | # Specify a social_media_url where others can refer to, for example a twitter 50 | # profile URL. 51 | # 52 | 53 | s.author = { "pujiaxin33" => "317437084@qq.com" } 54 | 55 | # ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 56 | # 57 | # If this Pod runs only on iOS or OS X, then specify the platform and 58 | # the deployment target. You can optionally include the target after the platform. 59 | # 60 | 61 | # s.platform = :ios 62 | s.platform = :ios, "8.0" 63 | 64 | # When using multiple platforms 65 | # s.ios.deployment_target = "5.0" 66 | # s.osx.deployment_target = "10.7" 67 | # s.watchos.deployment_target = "2.0" 68 | # s.tvos.deployment_target = "9.0" 69 | 70 | 71 | # ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 72 | # 73 | # Specify the location from where the source should be retrieved. 74 | # Supports git, hg, bzr, svn and HTTP. 75 | # 76 | 77 | s.source = { :git => "https://github.com/pujiaxin33/JXMovableCellTableView.git", :tag => "#{s.version}" } 78 | 79 | 80 | # ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 81 | # 82 | # CocoaPods is smart about how it includes source code. For source files 83 | # giving a folder will include any swift, h, m, mm, c & cpp files. 84 | # For header files it will include any header in the folder. 85 | # Not including the public_header_files will make all headers public. 86 | # 87 | 88 | s.source_files = "Classes", "Classes/**/*.{h,m}" 89 | 90 | # s.public_header_files = "Classes/**/*.h" 91 | 92 | 93 | # ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 94 | # 95 | # A list of resources included with the Pod. These are copied into the 96 | # target bundle with a build phase script. Anything else will be cleaned. 97 | # You can preserve files from being cleaned, please don't preserve 98 | # non-essential files like tests, examples and documentation. 99 | # 100 | 101 | # s.resource = "icon.png" 102 | # s.resources = "Resources/*.png" 103 | 104 | # s.preserve_paths = "FilesToSave", "MoreFilesToSave" 105 | 106 | 107 | # ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 108 | # 109 | # Link your library with frameworks, or libraries. Libraries do not include 110 | # the lib prefix of their name. 111 | # 112 | 113 | # s.framework = "SomeFramework" 114 | # s.frameworks = "SomeFramework", "AnotherFramework" 115 | 116 | # s.library = "iconv" 117 | # s.libraries = "iconv", "xml2" 118 | 119 | 120 | # ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 121 | # 122 | # If your library depends on compiler flags you can set them in the xcconfig hash 123 | # where they will only apply to your library. If you depend on other Podspecs 124 | # you can include multiple dependencies to ensure it works. 125 | 126 | s.requires_arc = true 127 | 128 | # s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" } 129 | # s.dependency "JSONKit", "~> 1.4" 130 | 131 | end 132 | -------------------------------------------------------------------------------- /JXMovableCellTableView.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 190F6A66213D452600870498 /* JXMovableCellTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 190F6A65213D452600870498 /* JXMovableCellTableView.m */; }; 11 | 192AC59920EF67B8003F478C /* NeonLight.gif in Resources */ = {isa = PBXBuildFile; fileRef = 192AC59520EF67B8003F478C /* NeonLight.gif */; }; 12 | 192AC59A20EF67B8003F478C /* EdgeScroll.gif in Resources */ = {isa = PBXBuildFile; fileRef = 192AC59620EF67B8003F478C /* EdgeScroll.gif */; }; 13 | 192AC59C20EF6944003F478C /* Breath.gif in Resources */ = {isa = PBXBuildFile; fileRef = 192AC59B20EF6944003F478C /* Breath.gif */; }; 14 | 194574811C71D8480093838F /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 194574801C71D8480093838F /* main.m */; }; 15 | 194574841C71D8480093838F /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 194574831C71D8480093838F /* AppDelegate.m */; }; 16 | 194574871C71D8480093838F /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 194574861C71D8480093838F /* ViewController.m */; }; 17 | 1945748A1C71D8480093838F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 194574881C71D8480093838F /* Main.storyboard */; }; 18 | 1945748C1C71D8480093838F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1945748B1C71D8480093838F /* Assets.xcassets */; }; 19 | 1945748F1C71D8480093838F /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1945748D1C71D8480093838F /* LaunchScreen.storyboard */; }; 20 | 1945749A1C71D8480093838F /* JXMovableCellTableViewTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 194574991C71D8480093838F /* JXMovableCellTableViewTests.m */; }; 21 | 194574A51C71D8480093838F /* JXMovableCellTableViewUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 194574A41C71D8480093838F /* JXMovableCellTableViewUITests.m */; }; 22 | 94ABB2DD24C7E77700947D65 /* JXTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 94ABB2DA24C7E77700947D65 /* JXTableViewCell.m */; }; 23 | 94ABB2DE24C7E77700947D65 /* JXTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 94ABB2DC24C7E77700947D65 /* JXTableViewCell.xib */; }; 24 | /* End PBXBuildFile section */ 25 | 26 | /* Begin PBXContainerItemProxy section */ 27 | 194574961C71D8480093838F /* PBXContainerItemProxy */ = { 28 | isa = PBXContainerItemProxy; 29 | containerPortal = 194574741C71D8480093838F /* Project object */; 30 | proxyType = 1; 31 | remoteGlobalIDString = 1945747B1C71D8480093838F; 32 | remoteInfo = JXMovableCellTableView; 33 | }; 34 | 194574A11C71D8480093838F /* PBXContainerItemProxy */ = { 35 | isa = PBXContainerItemProxy; 36 | containerPortal = 194574741C71D8480093838F /* Project object */; 37 | proxyType = 1; 38 | remoteGlobalIDString = 1945747B1C71D8480093838F; 39 | remoteInfo = JXMovableCellTableView; 40 | }; 41 | /* End PBXContainerItemProxy section */ 42 | 43 | /* Begin PBXFileReference section */ 44 | 190F6A64213D452600870498 /* JXMovableCellTableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JXMovableCellTableView.h; sourceTree = ""; }; 45 | 190F6A65213D452600870498 /* JXMovableCellTableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JXMovableCellTableView.m; sourceTree = ""; }; 46 | 192AC59520EF67B8003F478C /* NeonLight.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = NeonLight.gif; sourceTree = ""; }; 47 | 192AC59620EF67B8003F478C /* EdgeScroll.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = EdgeScroll.gif; sourceTree = ""; }; 48 | 192AC59B20EF6944003F478C /* Breath.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = Breath.gif; sourceTree = ""; }; 49 | 1945747C1C71D8480093838F /* JXMovableCellTableView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = JXMovableCellTableView.app; sourceTree = BUILT_PRODUCTS_DIR; }; 50 | 194574801C71D8480093838F /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 51 | 194574821C71D8480093838F /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 52 | 194574831C71D8480093838F /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 53 | 194574851C71D8480093838F /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 54 | 194574861C71D8480093838F /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 55 | 194574891C71D8480093838F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 56 | 1945748B1C71D8480093838F /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 57 | 1945748E1C71D8480093838F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 58 | 194574901C71D8480093838F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 59 | 194574951C71D8480093838F /* JXMovableCellTableViewTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = JXMovableCellTableViewTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 60 | 194574991C71D8480093838F /* JXMovableCellTableViewTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JXMovableCellTableViewTests.m; sourceTree = ""; }; 61 | 1945749B1C71D8480093838F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 62 | 194574A01C71D8480093838F /* JXMovableCellTableViewUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = JXMovableCellTableViewUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 63 | 194574A41C71D8480093838F /* JXMovableCellTableViewUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JXMovableCellTableViewUITests.m; sourceTree = ""; }; 64 | 194574A61C71D8480093838F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 65 | 94ABB2DA24C7E77700947D65 /* JXTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JXTableViewCell.m; sourceTree = ""; }; 66 | 94ABB2DB24C7E77700947D65 /* JXTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JXTableViewCell.h; sourceTree = ""; }; 67 | 94ABB2DC24C7E77700947D65 /* JXTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = JXTableViewCell.xib; sourceTree = ""; }; 68 | /* End PBXFileReference section */ 69 | 70 | /* Begin PBXFrameworksBuildPhase section */ 71 | 194574791C71D8480093838F /* Frameworks */ = { 72 | isa = PBXFrameworksBuildPhase; 73 | buildActionMask = 2147483647; 74 | files = ( 75 | ); 76 | runOnlyForDeploymentPostprocessing = 0; 77 | }; 78 | 194574921C71D8480093838F /* Frameworks */ = { 79 | isa = PBXFrameworksBuildPhase; 80 | buildActionMask = 2147483647; 81 | files = ( 82 | ); 83 | runOnlyForDeploymentPostprocessing = 0; 84 | }; 85 | 1945749D1C71D8480093838F /* Frameworks */ = { 86 | isa = PBXFrameworksBuildPhase; 87 | buildActionMask = 2147483647; 88 | files = ( 89 | ); 90 | runOnlyForDeploymentPostprocessing = 0; 91 | }; 92 | /* End PBXFrameworksBuildPhase section */ 93 | 94 | /* Begin PBXGroup section */ 95 | 190F6A63213D452600870498 /* Classes */ = { 96 | isa = PBXGroup; 97 | children = ( 98 | 190F6A64213D452600870498 /* JXMovableCellTableView.h */, 99 | 190F6A65213D452600870498 /* JXMovableCellTableView.m */, 100 | ); 101 | path = Classes; 102 | sourceTree = SOURCE_ROOT; 103 | }; 104 | 192AC59320EF67B8003F478C /* Gifs */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | 192AC59B20EF6944003F478C /* Breath.gif */, 108 | 192AC59520EF67B8003F478C /* NeonLight.gif */, 109 | 192AC59620EF67B8003F478C /* EdgeScroll.gif */, 110 | ); 111 | path = Gifs; 112 | sourceTree = ""; 113 | }; 114 | 194574731C71D8480093838F = { 115 | isa = PBXGroup; 116 | children = ( 117 | 1945747E1C71D8480093838F /* JXMovableCellTableView */, 118 | 194574981C71D8480093838F /* JXMovableCellTableViewTests */, 119 | 194574A31C71D8480093838F /* JXMovableCellTableViewUITests */, 120 | 1945747D1C71D8480093838F /* Products */, 121 | ); 122 | sourceTree = ""; 123 | }; 124 | 1945747D1C71D8480093838F /* Products */ = { 125 | isa = PBXGroup; 126 | children = ( 127 | 1945747C1C71D8480093838F /* JXMovableCellTableView.app */, 128 | 194574951C71D8480093838F /* JXMovableCellTableViewTests.xctest */, 129 | 194574A01C71D8480093838F /* JXMovableCellTableViewUITests.xctest */, 130 | ); 131 | name = Products; 132 | sourceTree = ""; 133 | }; 134 | 1945747E1C71D8480093838F /* JXMovableCellTableView */ = { 135 | isa = PBXGroup; 136 | children = ( 137 | 190F6A63213D452600870498 /* Classes */, 138 | 192AC59320EF67B8003F478C /* Gifs */, 139 | 194574821C71D8480093838F /* AppDelegate.h */, 140 | 194574831C71D8480093838F /* AppDelegate.m */, 141 | 94ABB2DB24C7E77700947D65 /* JXTableViewCell.h */, 142 | 94ABB2DA24C7E77700947D65 /* JXTableViewCell.m */, 143 | 94ABB2DC24C7E77700947D65 /* JXTableViewCell.xib */, 144 | 194574851C71D8480093838F /* ViewController.h */, 145 | 194574861C71D8480093838F /* ViewController.m */, 146 | 194574881C71D8480093838F /* Main.storyboard */, 147 | 1945748B1C71D8480093838F /* Assets.xcassets */, 148 | 1945748D1C71D8480093838F /* LaunchScreen.storyboard */, 149 | 194574901C71D8480093838F /* Info.plist */, 150 | 1945747F1C71D8480093838F /* Supporting Files */, 151 | ); 152 | path = JXMovableCellTableView; 153 | sourceTree = ""; 154 | }; 155 | 1945747F1C71D8480093838F /* Supporting Files */ = { 156 | isa = PBXGroup; 157 | children = ( 158 | 194574801C71D8480093838F /* main.m */, 159 | ); 160 | name = "Supporting Files"; 161 | sourceTree = ""; 162 | }; 163 | 194574981C71D8480093838F /* JXMovableCellTableViewTests */ = { 164 | isa = PBXGroup; 165 | children = ( 166 | 194574991C71D8480093838F /* JXMovableCellTableViewTests.m */, 167 | 1945749B1C71D8480093838F /* Info.plist */, 168 | ); 169 | path = JXMovableCellTableViewTests; 170 | sourceTree = ""; 171 | }; 172 | 194574A31C71D8480093838F /* JXMovableCellTableViewUITests */ = { 173 | isa = PBXGroup; 174 | children = ( 175 | 194574A41C71D8480093838F /* JXMovableCellTableViewUITests.m */, 176 | 194574A61C71D8480093838F /* Info.plist */, 177 | ); 178 | path = JXMovableCellTableViewUITests; 179 | sourceTree = ""; 180 | }; 181 | /* End PBXGroup section */ 182 | 183 | /* Begin PBXNativeTarget section */ 184 | 1945747B1C71D8480093838F /* JXMovableCellTableView */ = { 185 | isa = PBXNativeTarget; 186 | buildConfigurationList = 194574A91C71D8480093838F /* Build configuration list for PBXNativeTarget "JXMovableCellTableView" */; 187 | buildPhases = ( 188 | 194574781C71D8480093838F /* Sources */, 189 | 194574791C71D8480093838F /* Frameworks */, 190 | 1945747A1C71D8480093838F /* Resources */, 191 | ); 192 | buildRules = ( 193 | ); 194 | dependencies = ( 195 | ); 196 | name = JXMovableCellTableView; 197 | productName = JXMovableCellTableView; 198 | productReference = 1945747C1C71D8480093838F /* JXMovableCellTableView.app */; 199 | productType = "com.apple.product-type.application"; 200 | }; 201 | 194574941C71D8480093838F /* JXMovableCellTableViewTests */ = { 202 | isa = PBXNativeTarget; 203 | buildConfigurationList = 194574AC1C71D8480093838F /* Build configuration list for PBXNativeTarget "JXMovableCellTableViewTests" */; 204 | buildPhases = ( 205 | 194574911C71D8480093838F /* Sources */, 206 | 194574921C71D8480093838F /* Frameworks */, 207 | 194574931C71D8480093838F /* Resources */, 208 | ); 209 | buildRules = ( 210 | ); 211 | dependencies = ( 212 | 194574971C71D8480093838F /* PBXTargetDependency */, 213 | ); 214 | name = JXMovableCellTableViewTests; 215 | productName = JXMovableCellTableViewTests; 216 | productReference = 194574951C71D8480093838F /* JXMovableCellTableViewTests.xctest */; 217 | productType = "com.apple.product-type.bundle.unit-test"; 218 | }; 219 | 1945749F1C71D8480093838F /* JXMovableCellTableViewUITests */ = { 220 | isa = PBXNativeTarget; 221 | buildConfigurationList = 194574AF1C71D8480093838F /* Build configuration list for PBXNativeTarget "JXMovableCellTableViewUITests" */; 222 | buildPhases = ( 223 | 1945749C1C71D8480093838F /* Sources */, 224 | 1945749D1C71D8480093838F /* Frameworks */, 225 | 1945749E1C71D8480093838F /* Resources */, 226 | ); 227 | buildRules = ( 228 | ); 229 | dependencies = ( 230 | 194574A21C71D8480093838F /* PBXTargetDependency */, 231 | ); 232 | name = JXMovableCellTableViewUITests; 233 | productName = JXMovableCellTableViewUITests; 234 | productReference = 194574A01C71D8480093838F /* JXMovableCellTableViewUITests.xctest */; 235 | productType = "com.apple.product-type.bundle.ui-testing"; 236 | }; 237 | /* End PBXNativeTarget section */ 238 | 239 | /* Begin PBXProject section */ 240 | 194574741C71D8480093838F /* Project object */ = { 241 | isa = PBXProject; 242 | attributes = { 243 | CLASSPREFIX = JX; 244 | LastUpgradeCheck = 0720; 245 | ORGANIZATIONNAME = jiaxin; 246 | TargetAttributes = { 247 | 1945747B1C71D8480093838F = { 248 | CreatedOnToolsVersion = 7.2; 249 | DevelopmentTeam = CUHY5967Q2; 250 | }; 251 | 194574941C71D8480093838F = { 252 | CreatedOnToolsVersion = 7.2; 253 | TestTargetID = 1945747B1C71D8480093838F; 254 | }; 255 | 1945749F1C71D8480093838F = { 256 | CreatedOnToolsVersion = 7.2; 257 | TestTargetID = 1945747B1C71D8480093838F; 258 | }; 259 | }; 260 | }; 261 | buildConfigurationList = 194574771C71D8480093838F /* Build configuration list for PBXProject "JXMovableCellTableView" */; 262 | compatibilityVersion = "Xcode 3.2"; 263 | developmentRegion = English; 264 | hasScannedForEncodings = 0; 265 | knownRegions = ( 266 | English, 267 | en, 268 | Base, 269 | ); 270 | mainGroup = 194574731C71D8480093838F; 271 | productRefGroup = 1945747D1C71D8480093838F /* Products */; 272 | projectDirPath = ""; 273 | projectRoot = ""; 274 | targets = ( 275 | 1945747B1C71D8480093838F /* JXMovableCellTableView */, 276 | 194574941C71D8480093838F /* JXMovableCellTableViewTests */, 277 | 1945749F1C71D8480093838F /* JXMovableCellTableViewUITests */, 278 | ); 279 | }; 280 | /* End PBXProject section */ 281 | 282 | /* Begin PBXResourcesBuildPhase section */ 283 | 1945747A1C71D8480093838F /* Resources */ = { 284 | isa = PBXResourcesBuildPhase; 285 | buildActionMask = 2147483647; 286 | files = ( 287 | 1945748F1C71D8480093838F /* LaunchScreen.storyboard in Resources */, 288 | 192AC59A20EF67B8003F478C /* EdgeScroll.gif in Resources */, 289 | 192AC59C20EF6944003F478C /* Breath.gif in Resources */, 290 | 192AC59920EF67B8003F478C /* NeonLight.gif in Resources */, 291 | 1945748C1C71D8480093838F /* Assets.xcassets in Resources */, 292 | 1945748A1C71D8480093838F /* Main.storyboard in Resources */, 293 | 94ABB2DE24C7E77700947D65 /* JXTableViewCell.xib in Resources */, 294 | ); 295 | runOnlyForDeploymentPostprocessing = 0; 296 | }; 297 | 194574931C71D8480093838F /* Resources */ = { 298 | isa = PBXResourcesBuildPhase; 299 | buildActionMask = 2147483647; 300 | files = ( 301 | ); 302 | runOnlyForDeploymentPostprocessing = 0; 303 | }; 304 | 1945749E1C71D8480093838F /* Resources */ = { 305 | isa = PBXResourcesBuildPhase; 306 | buildActionMask = 2147483647; 307 | files = ( 308 | ); 309 | runOnlyForDeploymentPostprocessing = 0; 310 | }; 311 | /* End PBXResourcesBuildPhase section */ 312 | 313 | /* Begin PBXSourcesBuildPhase section */ 314 | 194574781C71D8480093838F /* Sources */ = { 315 | isa = PBXSourcesBuildPhase; 316 | buildActionMask = 2147483647; 317 | files = ( 318 | 194574871C71D8480093838F /* ViewController.m in Sources */, 319 | 194574841C71D8480093838F /* AppDelegate.m in Sources */, 320 | 94ABB2DD24C7E77700947D65 /* JXTableViewCell.m in Sources */, 321 | 190F6A66213D452600870498 /* JXMovableCellTableView.m in Sources */, 322 | 194574811C71D8480093838F /* main.m in Sources */, 323 | ); 324 | runOnlyForDeploymentPostprocessing = 0; 325 | }; 326 | 194574911C71D8480093838F /* Sources */ = { 327 | isa = PBXSourcesBuildPhase; 328 | buildActionMask = 2147483647; 329 | files = ( 330 | 1945749A1C71D8480093838F /* JXMovableCellTableViewTests.m in Sources */, 331 | ); 332 | runOnlyForDeploymentPostprocessing = 0; 333 | }; 334 | 1945749C1C71D8480093838F /* Sources */ = { 335 | isa = PBXSourcesBuildPhase; 336 | buildActionMask = 2147483647; 337 | files = ( 338 | 194574A51C71D8480093838F /* JXMovableCellTableViewUITests.m in Sources */, 339 | ); 340 | runOnlyForDeploymentPostprocessing = 0; 341 | }; 342 | /* End PBXSourcesBuildPhase section */ 343 | 344 | /* Begin PBXTargetDependency section */ 345 | 194574971C71D8480093838F /* PBXTargetDependency */ = { 346 | isa = PBXTargetDependency; 347 | target = 1945747B1C71D8480093838F /* JXMovableCellTableView */; 348 | targetProxy = 194574961C71D8480093838F /* PBXContainerItemProxy */; 349 | }; 350 | 194574A21C71D8480093838F /* PBXTargetDependency */ = { 351 | isa = PBXTargetDependency; 352 | target = 1945747B1C71D8480093838F /* JXMovableCellTableView */; 353 | targetProxy = 194574A11C71D8480093838F /* PBXContainerItemProxy */; 354 | }; 355 | /* End PBXTargetDependency section */ 356 | 357 | /* Begin PBXVariantGroup section */ 358 | 194574881C71D8480093838F /* Main.storyboard */ = { 359 | isa = PBXVariantGroup; 360 | children = ( 361 | 194574891C71D8480093838F /* Base */, 362 | ); 363 | name = Main.storyboard; 364 | sourceTree = ""; 365 | }; 366 | 1945748D1C71D8480093838F /* LaunchScreen.storyboard */ = { 367 | isa = PBXVariantGroup; 368 | children = ( 369 | 1945748E1C71D8480093838F /* Base */, 370 | ); 371 | name = LaunchScreen.storyboard; 372 | sourceTree = ""; 373 | }; 374 | /* End PBXVariantGroup section */ 375 | 376 | /* Begin XCBuildConfiguration section */ 377 | 194574A71C71D8480093838F /* Debug */ = { 378 | isa = XCBuildConfiguration; 379 | buildSettings = { 380 | ALWAYS_SEARCH_USER_PATHS = NO; 381 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 382 | CLANG_CXX_LIBRARY = "libc++"; 383 | CLANG_ENABLE_MODULES = YES; 384 | CLANG_ENABLE_OBJC_ARC = YES; 385 | CLANG_WARN_BOOL_CONVERSION = YES; 386 | CLANG_WARN_CONSTANT_CONVERSION = YES; 387 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 388 | CLANG_WARN_EMPTY_BODY = YES; 389 | CLANG_WARN_ENUM_CONVERSION = YES; 390 | CLANG_WARN_INT_CONVERSION = YES; 391 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 392 | CLANG_WARN_UNREACHABLE_CODE = YES; 393 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 394 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 395 | COPY_PHASE_STRIP = NO; 396 | DEBUG_INFORMATION_FORMAT = dwarf; 397 | ENABLE_STRICT_OBJC_MSGSEND = YES; 398 | ENABLE_TESTABILITY = YES; 399 | GCC_C_LANGUAGE_STANDARD = gnu99; 400 | GCC_DYNAMIC_NO_PIC = NO; 401 | GCC_NO_COMMON_BLOCKS = YES; 402 | GCC_OPTIMIZATION_LEVEL = 0; 403 | GCC_PREPROCESSOR_DEFINITIONS = ( 404 | "DEBUG=1", 405 | "$(inherited)", 406 | ); 407 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 408 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 409 | GCC_WARN_UNDECLARED_SELECTOR = YES; 410 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 411 | GCC_WARN_UNUSED_FUNCTION = YES; 412 | GCC_WARN_UNUSED_VARIABLE = YES; 413 | IPHONEOS_DEPLOYMENT_TARGET = 9.2; 414 | MTL_ENABLE_DEBUG_INFO = YES; 415 | ONLY_ACTIVE_ARCH = YES; 416 | SDKROOT = iphoneos; 417 | }; 418 | name = Debug; 419 | }; 420 | 194574A81C71D8480093838F /* Release */ = { 421 | isa = XCBuildConfiguration; 422 | buildSettings = { 423 | ALWAYS_SEARCH_USER_PATHS = NO; 424 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 425 | CLANG_CXX_LIBRARY = "libc++"; 426 | CLANG_ENABLE_MODULES = YES; 427 | CLANG_ENABLE_OBJC_ARC = YES; 428 | CLANG_WARN_BOOL_CONVERSION = YES; 429 | CLANG_WARN_CONSTANT_CONVERSION = YES; 430 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 431 | CLANG_WARN_EMPTY_BODY = YES; 432 | CLANG_WARN_ENUM_CONVERSION = YES; 433 | CLANG_WARN_INT_CONVERSION = YES; 434 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 435 | CLANG_WARN_UNREACHABLE_CODE = YES; 436 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 437 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 438 | COPY_PHASE_STRIP = NO; 439 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 440 | ENABLE_NS_ASSERTIONS = NO; 441 | ENABLE_STRICT_OBJC_MSGSEND = YES; 442 | GCC_C_LANGUAGE_STANDARD = gnu99; 443 | GCC_NO_COMMON_BLOCKS = YES; 444 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 445 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 446 | GCC_WARN_UNDECLARED_SELECTOR = YES; 447 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 448 | GCC_WARN_UNUSED_FUNCTION = YES; 449 | GCC_WARN_UNUSED_VARIABLE = YES; 450 | IPHONEOS_DEPLOYMENT_TARGET = 9.2; 451 | MTL_ENABLE_DEBUG_INFO = NO; 452 | SDKROOT = iphoneos; 453 | VALIDATE_PRODUCT = YES; 454 | }; 455 | name = Release; 456 | }; 457 | 194574AA1C71D8480093838F /* Debug */ = { 458 | isa = XCBuildConfiguration; 459 | buildSettings = { 460 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 461 | DEVELOPMENT_TEAM = CUHY5967Q2; 462 | INFOPLIST_FILE = JXMovableCellTableView/Info.plist; 463 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 464 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 465 | PRODUCT_BUNDLE_IDENTIFIER = com.jiaxin.JXMovableCellTableView.3; 466 | PRODUCT_NAME = "$(TARGET_NAME)"; 467 | }; 468 | name = Debug; 469 | }; 470 | 194574AB1C71D8480093838F /* Release */ = { 471 | isa = XCBuildConfiguration; 472 | buildSettings = { 473 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 474 | DEVELOPMENT_TEAM = CUHY5967Q2; 475 | INFOPLIST_FILE = JXMovableCellTableView/Info.plist; 476 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 477 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 478 | PRODUCT_BUNDLE_IDENTIFIER = com.jiaxin.JXMovableCellTableView.3; 479 | PRODUCT_NAME = "$(TARGET_NAME)"; 480 | }; 481 | name = Release; 482 | }; 483 | 194574AD1C71D8480093838F /* Debug */ = { 484 | isa = XCBuildConfiguration; 485 | buildSettings = { 486 | BUNDLE_LOADER = "$(TEST_HOST)"; 487 | INFOPLIST_FILE = JXMovableCellTableViewTests/Info.plist; 488 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 489 | PRODUCT_BUNDLE_IDENTIFIER = jiaxin.JXMovableCellTableViewTests; 490 | PRODUCT_NAME = "$(TARGET_NAME)"; 491 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/JXMovableCellTableView.app/JXMovableCellTableView"; 492 | }; 493 | name = Debug; 494 | }; 495 | 194574AE1C71D8480093838F /* Release */ = { 496 | isa = XCBuildConfiguration; 497 | buildSettings = { 498 | BUNDLE_LOADER = "$(TEST_HOST)"; 499 | INFOPLIST_FILE = JXMovableCellTableViewTests/Info.plist; 500 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 501 | PRODUCT_BUNDLE_IDENTIFIER = jiaxin.JXMovableCellTableViewTests; 502 | PRODUCT_NAME = "$(TARGET_NAME)"; 503 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/JXMovableCellTableView.app/JXMovableCellTableView"; 504 | }; 505 | name = Release; 506 | }; 507 | 194574B01C71D8480093838F /* Debug */ = { 508 | isa = XCBuildConfiguration; 509 | buildSettings = { 510 | INFOPLIST_FILE = JXMovableCellTableViewUITests/Info.plist; 511 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 512 | PRODUCT_BUNDLE_IDENTIFIER = jiaxin.JXMovableCellTableViewUITests; 513 | PRODUCT_NAME = "$(TARGET_NAME)"; 514 | TEST_TARGET_NAME = JXMovableCellTableView; 515 | USES_XCTRUNNER = YES; 516 | }; 517 | name = Debug; 518 | }; 519 | 194574B11C71D8480093838F /* Release */ = { 520 | isa = XCBuildConfiguration; 521 | buildSettings = { 522 | INFOPLIST_FILE = JXMovableCellTableViewUITests/Info.plist; 523 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 524 | PRODUCT_BUNDLE_IDENTIFIER = jiaxin.JXMovableCellTableViewUITests; 525 | PRODUCT_NAME = "$(TARGET_NAME)"; 526 | TEST_TARGET_NAME = JXMovableCellTableView; 527 | USES_XCTRUNNER = YES; 528 | }; 529 | name = Release; 530 | }; 531 | /* End XCBuildConfiguration section */ 532 | 533 | /* Begin XCConfigurationList section */ 534 | 194574771C71D8480093838F /* Build configuration list for PBXProject "JXMovableCellTableView" */ = { 535 | isa = XCConfigurationList; 536 | buildConfigurations = ( 537 | 194574A71C71D8480093838F /* Debug */, 538 | 194574A81C71D8480093838F /* Release */, 539 | ); 540 | defaultConfigurationIsVisible = 0; 541 | defaultConfigurationName = Release; 542 | }; 543 | 194574A91C71D8480093838F /* Build configuration list for PBXNativeTarget "JXMovableCellTableView" */ = { 544 | isa = XCConfigurationList; 545 | buildConfigurations = ( 546 | 194574AA1C71D8480093838F /* Debug */, 547 | 194574AB1C71D8480093838F /* Release */, 548 | ); 549 | defaultConfigurationIsVisible = 0; 550 | defaultConfigurationName = Release; 551 | }; 552 | 194574AC1C71D8480093838F /* Build configuration list for PBXNativeTarget "JXMovableCellTableViewTests" */ = { 553 | isa = XCConfigurationList; 554 | buildConfigurations = ( 555 | 194574AD1C71D8480093838F /* Debug */, 556 | 194574AE1C71D8480093838F /* Release */, 557 | ); 558 | defaultConfigurationIsVisible = 0; 559 | defaultConfigurationName = Release; 560 | }; 561 | 194574AF1C71D8480093838F /* Build configuration list for PBXNativeTarget "JXMovableCellTableViewUITests" */ = { 562 | isa = XCConfigurationList; 563 | buildConfigurations = ( 564 | 194574B01C71D8480093838F /* Debug */, 565 | 194574B11C71D8480093838F /* Release */, 566 | ); 567 | defaultConfigurationIsVisible = 0; 568 | defaultConfigurationName = Release; 569 | }; 570 | /* End XCConfigurationList section */ 571 | }; 572 | rootObject = 194574741C71D8480093838F /* Project object */; 573 | } 574 | -------------------------------------------------------------------------------- /JXMovableCellTableView.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /JXMovableCellTableView.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /JXMovableCellTableView.xcodeproj/xcuserdata/jiaxin.xcuserdatad/xcschemes/JXMovableCellTableView.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 43 | 49 | 50 | 51 | 52 | 53 | 59 | 60 | 61 | 62 | 63 | 64 | 74 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 95 | 101 | 102 | 103 | 104 | 106 | 107 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /JXMovableCellTableView.xcodeproj/xcuserdata/jiaxin.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | JXMovableCellTableView.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 1945747B1C71D8480093838F 16 | 17 | primary 18 | 19 | 20 | 194574941C71D8480093838F 21 | 22 | primary 23 | 24 | 25 | 1945749F1C71D8480093838F 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /JXMovableCellTableView/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // JXMovableCellTableView 4 | // 5 | // Created by jiaxin on 16/2/15. 6 | // Copyright © 2016年 jiaxin. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /JXMovableCellTableView/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // JXMovableCellTableView 4 | // 5 | // Created by jiaxin on 16/2/15. 6 | // Copyright © 2016年 jiaxin. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /JXMovableCellTableView/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /JXMovableCellTableView/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /JXMovableCellTableView/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /JXMovableCellTableView/Gifs/Breath.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pujiaxin33/JXMovableCellTableView/8183048efa59d5a76e498d87d1a7e3f0dec2b00b/JXMovableCellTableView/Gifs/Breath.gif -------------------------------------------------------------------------------- /JXMovableCellTableView/Gifs/EdgeScroll.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pujiaxin33/JXMovableCellTableView/8183048efa59d5a76e498d87d1a7e3f0dec2b00b/JXMovableCellTableView/Gifs/EdgeScroll.gif -------------------------------------------------------------------------------- /JXMovableCellTableView/Gifs/NeonLight.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pujiaxin33/JXMovableCellTableView/8183048efa59d5a76e498d87d1a7e3f0dec2b00b/JXMovableCellTableView/Gifs/NeonLight.gif -------------------------------------------------------------------------------- /JXMovableCellTableView/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /JXMovableCellTableView/JXTableViewCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // JXTableViewCell.h 3 | // JXMovableCellTableView 4 | // 5 | // Created by VM on 2020/7/22. 6 | // Copyright © 2020 jiaxin. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface JXTableViewCell : UITableViewCell 14 | @property (weak, nonatomic) IBOutlet UIView *bgView; 15 | @property (weak, nonatomic) IBOutlet UILabel *indexLabel; 16 | 17 | @end 18 | 19 | NS_ASSUME_NONNULL_END 20 | -------------------------------------------------------------------------------- /JXMovableCellTableView/JXTableViewCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // JXTableViewCell.m 3 | // JXMovableCellTableView 4 | // 5 | // Created by VM on 2020/7/22. 6 | // Copyright © 2020 jiaxin. All rights reserved. 7 | // 8 | 9 | #import "JXTableViewCell.h" 10 | 11 | @implementation JXTableViewCell 12 | 13 | - (void)awakeFromNib { 14 | [super awakeFromNib]; 15 | // Initialization code 16 | self.bgView.layer.cornerRadius = 10; 17 | self.bgView.layer.masksToBounds = YES; 18 | } 19 | 20 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated { 21 | [super setSelected:selected animated:animated]; 22 | 23 | // Configure the view for the selected state 24 | } 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /JXMovableCellTableView/JXTableViewCell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /JXMovableCellTableView/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // JXMovableCellTableView 4 | // 5 | // Created by jiaxin on 16/2/15. 6 | // Copyright © 2016年 jiaxin. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /JXMovableCellTableView/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // JXMovableCellTableView 4 | // 5 | // Created by jiaxin on 16/2/15. 6 | // Copyright © 2016年 jiaxin. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "JXMovableCellTableView.h" 11 | #import "JXTableViewCell.h" 12 | 13 | @interface ViewController () 14 | @property (nonatomic, strong) JXMovableCellTableView *tableView; 15 | @property (nonatomic, strong) NSMutableArray *dataSource; 16 | @end 17 | 18 | @implementation ViewController 19 | 20 | - (void)viewDidLoad { 21 | [super viewDidLoad]; 22 | 23 | self.title = @"JXMovableCellTableView"; 24 | self.edgesForExtendedLayout = UIRectEdgeNone; 25 | 26 | _dataSource = [NSMutableArray new]; 27 | NSArray *sectionTextArray = @[@"I am just a plain text 😳", 28 | @"I am just a lovely text 😊", 29 | @"I am just a naughty text 😜", 30 | @"I am just a boring text 🙈"]; 31 | for (NSInteger section = 0; section < sectionTextArray.count; section ++) { 32 | NSMutableArray *sectionArray = [NSMutableArray new]; 33 | for (NSInteger row = 0; row < 20; row ++) { 34 | [sectionArray addObject:[NSString stringWithFormat:@"%@-%ld", sectionTextArray[section], row]]; 35 | } 36 | [_dataSource addObject:sectionArray]; 37 | } 38 | 39 | _tableView = [[JXMovableCellTableView alloc] initWithFrame:self.view.bounds style:UITableViewStyleGrouped]; 40 | _tableView.backgroundColor = [UIColor whiteColor]; 41 | _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; 42 | _tableView.dataSource = self; 43 | _tableView.delegate = self; 44 | // _tableView.canHintWhenCannotMove = NO; 45 | _tableView.canFeedback = YES; 46 | [self.view addSubview:_tableView]; 47 | [self.tableView registerNib:[UINib nibWithNibName:NSStringFromClass([JXTableViewCell class]) bundle:nil] forCellReuseIdentifier:NSStringFromClass([JXTableViewCell class])]; 48 | 49 | _tableView.longPressGesture.minimumPressDuration = 1.0; 50 | } 51 | 52 | - (void)viewDidLayoutSubviews { 53 | [super viewDidLayoutSubviews]; 54 | 55 | _tableView.frame = self.view.bounds; 56 | } 57 | 58 | #pragma mark - JXMovableCellTableViewDataSource 59 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 60 | { 61 | return _dataSource.count; 62 | } 63 | 64 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 65 | { 66 | return [_dataSource[section] count]; 67 | } 68 | 69 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { 70 | return 100; 71 | } 72 | 73 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 74 | { 75 | JXTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([JXTableViewCell class]) forIndexPath:indexPath]; 76 | cell.indexLabel.text = self.dataSource[indexPath.section][indexPath.row]; 77 | return cell; 78 | } 79 | 80 | - (NSMutableArray *)dataSourceArrayInTableView:(JXMovableCellTableView *)tableView 81 | { 82 | return _dataSource; 83 | } 84 | 85 | //自定义拖拽的view 86 | - (UIView *)snapshotViewWithCell:(JXTableViewCell *)cell{ 87 | return cell.bgView; 88 | } 89 | 90 | #pragma mark - JXMovableCellTableViewDelegate 91 | 92 | - (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath 93 | { 94 | //第二组禁止拖拽 95 | if (indexPath.section == 1) { 96 | return NO; 97 | } 98 | 99 | return YES; 100 | } 101 | 102 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 103 | { 104 | NSLog(@"%@", NSStringFromSelector(_cmd)); 105 | } 106 | 107 | 108 | - (void)tableView:(JXMovableCellTableView *)tableView customizeMovalbeCell:(UIImageView *)movableCellsnapshot { 109 | movableCellsnapshot.layer.shadowColor = [[UIColor blackColor] colorWithAlphaComponent:0.5].CGColor; 110 | movableCellsnapshot.layer.masksToBounds = NO; 111 | movableCellsnapshot.layer.cornerRadius = 10; 112 | movableCellsnapshot.layer.shadowOffset = CGSizeMake(0, 0); 113 | movableCellsnapshot.layer.shadowOpacity = 1.0; 114 | movableCellsnapshot.layer.shadowRadius = 10; 115 | 116 | } 117 | 118 | //- (void)tableView:(JXMovableCellTableView *)tableView customizeStartMovingAnimation:(UIImageView *)movableCellsnapshot fingerPoint:(CGPoint)fingerPoint { 119 | // //move to finger 120 | // [UIView animateWithDuration:0.25 animations:^{ 121 | // movableCellsnapshot.center = CGPointMake(movableCellsnapshot.center.x, fingerPoint.y); 122 | // }]; 123 | 124 | //scale big 125 | // [UIView animateWithDuration:0.25 animations:^{ 126 | // movableCellsnapshot.transform = CGAffineTransformMakeScale(1.1, 1.1); 127 | // }]; 128 | 129 | //like a breath 130 | // [UIView animateWithDuration:1 delay:0 options:UIViewAnimationOptionAutoreverse | UIViewAnimationOptionRepeat animations:^{ 131 | // movableCellsnapshot.transform = CGAffineTransformMakeScale(1.1, 1.1); 132 | // } completion:^(BOOL finished) { 133 | // 134 | // }]; 135 | 136 | //Neon light 137 | // CAKeyframeAnimation *colorAnimation = [CAKeyframeAnimation animationWithKeyPath:@"shadowColor"]; 138 | // colorAnimation.duration = 5; 139 | // colorAnimation.values = @[ 140 | // (__bridge id)[UIColor redColor].CGColor, 141 | // (__bridge id)[UIColor blueColor].CGColor, 142 | // (__bridge id)[UIColor greenColor].CGColor, 143 | // (__bridge id)[UIColor yellowColor].CGColor, 144 | // (__bridge id)[UIColor purpleColor].CGColor, 145 | // (__bridge id)[UIColor orangeColor].CGColor, ]; 146 | // colorAnimation.repeatCount = INFINITY; 147 | // [movableCellsnapshot.layer addAnimation:colorAnimation forKey:@"color"]; 148 | 149 | 150 | //} 151 | 152 | 153 | @end 154 | -------------------------------------------------------------------------------- /JXMovableCellTableView/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // JXMovableCellTableView 4 | // 5 | // Created by jiaxin on 16/2/15. 6 | // Copyright © 2016年 jiaxin. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /JXMovableCellTableViewTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /JXMovableCellTableViewTests/JXMovableCellTableViewTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // JXMovableCellTableViewTests.m 3 | // JXMovableCellTableViewTests 4 | // 5 | // Created by jiaxin on 16/2/15. 6 | // Copyright © 2016年 jiaxin. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface JXMovableCellTableViewTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation JXMovableCellTableViewTests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | // Put setup code here. This method is called before the invocation of each test method in the class. 20 | } 21 | 22 | - (void)tearDown { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testExample { 28 | // This is an example of a functional test case. 29 | // Use XCTAssert and related functions to verify your tests produce the correct results. 30 | } 31 | 32 | - (void)testPerformanceExample { 33 | // This is an example of a performance test case. 34 | [self measureBlock:^{ 35 | // Put the code you want to measure the time of here. 36 | }]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /JXMovableCellTableViewUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /JXMovableCellTableViewUITests/JXMovableCellTableViewUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // JXMovableCellTableViewUITests.m 3 | // JXMovableCellTableViewUITests 4 | // 5 | // Created by jiaxin on 16/2/15. 6 | // Copyright © 2016年 jiaxin. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface JXMovableCellTableViewUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation JXMovableCellTableViewUITests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | 22 | // In UI tests it is usually best to stop immediately when a failure occurs. 23 | self.continueAfterFailure = NO; 24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 25 | [[[XCUIApplication alloc] init] launch]; 26 | 27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 28 | } 29 | 30 | - (void)tearDown { 31 | // Put teardown code here. This method is called after the invocation of each test method in the class. 32 | [super tearDown]; 33 | } 34 | 35 | - (void)testExample { 36 | // Use recording to get started writing UI tests. 37 | // Use XCTAssert and related functions to verify your tests produce the correct results. 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 暴走的鑫鑫 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.3 2 | // The swift-tools-version declares the minimum version of Swift required to build this package. 3 | 4 | import PackageDescription 5 | 6 | let package = Package( 7 | name: "JXMovableCellTableView", 8 | products: [ 9 | // Products define the executables and libraries a package produces, and make them visible to other packages. 10 | .library( 11 | name: "JXMovableCellTableView", 12 | targets: ["JXMovableCellTableView"]), 13 | ], 14 | dependencies: [ 15 | // Dependencies declare other packages that this package depends on. 16 | // .package(url: /* package url */, from: "1.0.0"), 17 | ], 18 | targets: [ 19 | // Targets are the basic building blocks of a package. A target can define a module or a test suite. 20 | // Targets can depend on other targets in this package, and on products in packages this package depends on. 21 | .target( 22 | name: "JXMovableCellTableView", 23 | path: "Classes", 24 | publicHeadersPath: "." 25 | ) 26 | ] 27 | ) 28 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Overview 2 | 3 | The custom tableView which can start moving the cell with a long press gesture. 4 | The JXMovableCellTableView which added a `UILongPressGestureRecognizer`. when gesture started take a snapshot for cell which pressed.Then you can customize movable cell and start move animation. 5 | 6 | 7 | [中文介绍](https://www.jianshu.com/p/ce382f9bc794) 8 | 9 | # Check it out! 10 | 11 | - **Edge scroll** 12 | 13 | ![EdgeScroll](https://github.com/pujiaxin33/JXMovableCellTableView/blob/master/JXMovableCellTableView/Gifs/EdgeScroll.gif) 14 | 15 | - **Neon light** 16 | 17 | ![Neonlight](https://github.com/pujiaxin33/JXMovableCellTableView/blob/master/JXMovableCellTableView/Gifs/NeonLight.gif) 18 | 19 | - **Breath** 20 | 21 | ![Breath](https://github.com/pujiaxin33/JXMovableCellTableView/blob/master/JXMovableCellTableView/Gifs/Breath.gif) 22 | 23 | 24 | # Features 25 | - Just need a long press gesture can start moving cell. Don't need call system api `[tableView setEditing:YES animated:YES];`. 26 | - Highly customizing the cell style being moved. 27 | - Highly customizing start move cell animation. 28 | - Support to move to the edge of the screen to scroll the tableview. 29 | 30 | # Usage 31 | 32 | - **`canEdgeScroll`** 33 | 34 | Whether to allow dragging to the edge of the screen, turn on edge scrolling.default YES. 35 | 36 | - **`edgeScrollRange`** 37 | 38 | The edge scrolls the trigger range, and the closer to the edge, the faster the speed. The default is 150. 39 | 40 | - **`JXMovableCellTableViewDelegate`** 41 | 42 | ``` 43 | /** 44 | * The cell that will start moving the indexPath location 45 | */ 46 | - (void)tableView:(JXMovableCellTableView *)tableView willMoveCellAtIndexPath:(NSIndexPath *)indexPath; 47 | /** 48 | * Move cell `fromIndexPath` to `toIndexPath` completed 49 | */ 50 | - (void)tableView:(JXMovableCellTableView *)tableView didMoveCellFromIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath; 51 | /** 52 | * Move cell ended 53 | */ 54 | - (void)tableView:(JXMovableCellTableView *)tableView endMoveCellAtIndexPath:(NSIndexPath *)indexPath; 55 | 56 | /** 57 | * The user tries to move a cell that is not allowed to move. You can make some prompts to inform the user. 58 | */ 59 | - (void)tableView:(JXMovableCellTableView *)tableView tryMoveUnmovableCellAtIndexPath:(NSIndexPath *)indexPath; 60 | 61 | /** 62 | * Customize the screenshot style of the movable cell 63 | */ 64 | - (void)tableView:(JXMovableCellTableView *)tableView customizeMovalbeCell:(UIImageView *)movableCellsnapshot; 65 | 66 | /** 67 | * Custom start moving cell animation 68 | */ 69 | - (void)tableView:(JXMovableCellTableView *)tableView customizeStartMovingAnimation:(UIImageView *)movableCellsnapshot fingerPoint:(CGPoint)fingerPoint; 70 | ``` 71 | 72 | - **`JXMovableCellTableViewDataSource`** 73 | 74 | ``` 75 | /** 76 | * Get the data source array of the tableView, each time you start the call to get the latest data source. 77 | * The array in the data source must be a mutable array, otherwise it cannot be exchanged 78 | * The format of the data source:@[@[sectionOneArray].mutableCopy, @[sectionTwoArray].mutableCopy, ....].mutableCopy 79 | * Even if there is only one section, the outermost layer needs to be wrapped in an array, such as:@[@[sectionOneArray].mutableCopy].mutableCopy 80 | */ 81 | - (NSMutableArray *)dataSourceArrayInTableView:(JXMovableCellTableView *)tableView; 82 | ``` 83 | 84 | # Installation 85 | 86 | ## Manual 87 | 88 | Download git reposity, decompress zip, drag JXMovableCellTableView.h&.m into your project. 89 | 90 | ## CocoaPods 91 | 92 | ```ruby 93 | target '' do 94 | pod 'JXMovableCellTableView' 95 | end 96 | ``` 97 | You should run `pod repo udpate` before `pod install` 98 | 99 | --------------------------------------------------------------------------------