├── RTDragCellTableView ├── RTModel.m ├── ViewController.h ├── AppDelegate.h ├── RTModel.h ├── main.m ├── RTDragCellTableView │ ├── RTDragCellTableView.h │ └── RTDragCellTableView.m ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── Main.storyboard │ └── LaunchScreen.storyboard ├── Info.plist ├── AppDelegate.m └── ViewController.m ├── RTDragCellTableView.xcodeproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ ├── mac.xcuserdatad │ │ └── UserInterfaceState.xcuserstate │ │ └── Rusted.xcuserdatad │ │ ├── UserInterfaceState.xcuserstate │ │ └── WorkspaceSettings.xcsettings ├── xcuserdata │ ├── mac.xcuserdatad │ │ └── xcschemes │ │ │ ├── xcschememanagement.plist │ │ │ └── RTDragCellTableView.xcscheme │ └── Rusted.xcuserdatad │ │ └── xcschemes │ │ ├── xcschememanagement.plist │ │ └── RTDragCellTableView.xcscheme └── project.pbxproj └── README.md /RTDragCellTableView/RTModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // RTModel.m 3 | // 4 | // Created by 傅祚鹏 on 16/2/12. 5 | // Copyright © 2016年 Rusted. All rights reserved. 6 | // 7 | 8 | #import "RTModel.h" 9 | 10 | @implementation RTModel 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /RTDragCellTableView.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /RTDragCellTableView.xcodeproj/project.xcworkspace/xcuserdata/mac.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustinhead/RTDragCellTableView/HEAD/RTDragCellTableView.xcodeproj/project.xcworkspace/xcuserdata/mac.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /RTDragCellTableView.xcodeproj/project.xcworkspace/xcuserdata/Rusted.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustinhead/RTDragCellTableView/HEAD/RTDragCellTableView.xcodeproj/project.xcworkspace/xcuserdata/Rusted.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /RTDragCellTableView/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // 4 | // Created by Rusted on 16/2/12. 5 | // Copyright © 2016年 Rusted. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | @interface ViewController : UIViewController 11 | 12 | 13 | @end 14 | 15 | -------------------------------------------------------------------------------- /RTDragCellTableView/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // RTDragCellTableView 4 | // 5 | // Copyright © 2016年 Rusted. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | @interface AppDelegate : UIResponder 11 | 12 | @property (strong, nonatomic) UIWindow *window; 13 | 14 | 15 | @end 16 | 17 | -------------------------------------------------------------------------------- /RTDragCellTableView/RTModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // RTModel.h 3 | // 4 | // Created by Rusted on 16/2/12. 5 | // Copyright © 2016年 Rusted. All rights reserved. 6 | // 7 | // 8 | #import 9 | 10 | @interface RTModel : NSObject 11 | 12 | @property (nonatomic, strong) UIColor *backgroundColor; 13 | @property (nonatomic, copy) NSString *title; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /RTDragCellTableView/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // RTDragCellTableView 4 | // 5 | // Copyright © 2016年 Rusted. All rights reserved. 6 | // 7 | 8 | #import 9 | #import "AppDelegate.h" 10 | 11 | int main(int argc, char * argv[]) { 12 | @autoreleasepool { 13 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /RTDragCellTableView.xcodeproj/xcuserdata/mac.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | RTDragCellTableView.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 14D0DF781C6EFF6900A10C10 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /RTDragCellTableView.xcodeproj/project.xcworkspace/xcuserdata/Rusted.xcuserdatad/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildLocationStyle 6 | UseAppPreferences 7 | CustomBuildLocationType 8 | RelativeToDerivedData 9 | DerivedDataLocationStyle 10 | Default 11 | IssueFilterStyle 12 | ShowActiveSchemeOnly 13 | LiveSourceIssuesEnabled 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /RTDragCellTableView.xcodeproj/xcuserdata/Rusted.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | RTDragCellTableView.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 14D0DF781C6EFF6900A10C10 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 可拖动cell重新排序的TableView 2 | 仿iPhone自带天气应用,可对tableView中的cell拖动排序,可跨section拖动排序,拖动同时更新外部数据源,拖动至边缘tableView可自动向上或向下滚动(如果可以滚动的话) 3 | 4 | 5 | 6 | 7 | 直接将RTDragCellTableView.h和RTDragCellTableView.m拖进你的项目即可使用 8 | 9 | 该控件扩充了原UITableView的数据源协议和代理协议中的方法,其中两个方法必须实现: 10 | 11 | -- DataSource -- 12 | /**将外部数据源数组传入,以便在移动cell数据发生改变时进行修改重排*/ 13 | - (NSArray *)originalArrayDataForTableView:(RTDragCellTableView *)tableView; 14 | 15 | -- Delegate -- 16 | /**将修改重排后的数组传入,以便外部更新数据源*/ 17 | - (void)tableView:(RTDragCellTableView *)tableView newArrayDataForDataSource:(NSArray *)newArray; 18 | 19 | 同时还扩充了三个代理方法,如下 20 | /**选中的cell准备好可以移动的时候*/ 21 | - (void)tableView:(RTDragCellTableView *)tableView cellReadyToMoveAtIndexPath:(NSIndexPath *)indexPath; 22 | 23 | /**选中的cell正在移动,变换位置,手势尚未松开*/ 24 | - (void)cellIsMovingInTableView:(RTDragCellTableView *)tableView; 25 | 26 | /**选中的cell完成移动,手势已松开*/ 27 | - (void)cellDidEndMovingInTableView:(RTDragCellTableView *)tableView; 28 | -------------------------------------------------------------------------------- /RTDragCellTableView/RTDragCellTableView/RTDragCellTableView.h: -------------------------------------------------------------------------------- 1 | // 2 | // RTDragCellTableView.h 3 | // 4 | // Created by Rusted on 16/2/12. 5 | // Copyright © 2016年 Rusted. All rights reserved. 6 | // 7 | 8 | #import 9 | @class RTDragCellTableView; 10 | @protocol RTDragCellTableViewDataSource 11 | 12 | @required 13 | /**将外部数据源数组传入,以便在移动cell数据发生改变时进行修改重排*/ 14 | - (NSArray *)originalArrayDataForTableView:(RTDragCellTableView *)tableView; 15 | 16 | @end 17 | 18 | @protocol RTDragCellTableViewDelegate 19 | 20 | @required 21 | /**将修改重排后的数组传入,以便外部更新数据源*/ 22 | - (void)tableView:(RTDragCellTableView *)tableView newArrayDataForDataSource:(NSArray *)newArray; 23 | @optional 24 | /**选中的cell准备好可以移动的时候*/ 25 | - (void)tableView:(RTDragCellTableView *)tableView cellReadyToMoveAtIndexPath:(NSIndexPath *)indexPath; 26 | /**选中的cell正在移动,变换位置,手势尚未松开*/ 27 | - (void)cellIsMovingInTableView:(RTDragCellTableView *)tableView; 28 | /**选中的cell完成移动,手势已松开*/ 29 | - (void)cellDidEndMovingInTableView:(RTDragCellTableView *)tableView; 30 | 31 | @end 32 | 33 | @interface RTDragCellTableView : UITableView 34 | 35 | @property (nonatomic, assign) id dataSource; 36 | @property (nonatomic, assign) id delegate; 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /RTDragCellTableView/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 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /RTDragCellTableView/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 | -------------------------------------------------------------------------------- /RTDragCellTableView/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 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /RTDragCellTableView/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 | -------------------------------------------------------------------------------- /RTDragCellTableView/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // RTDragCellTableView 4 | // 5 | // Copyright © 2016年 Rusted. All rights reserved. 6 | // 7 | 8 | #import "AppDelegate.h" 9 | 10 | @interface AppDelegate () 11 | 12 | @end 13 | 14 | @implementation AppDelegate 15 | 16 | 17 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 18 | // Override point for customization after application launch. 19 | return YES; 20 | } 21 | 22 | - (void)applicationWillResignActive:(UIApplication *)application { 23 | // 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. 24 | // 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. 25 | } 26 | 27 | - (void)applicationDidEnterBackground:(UIApplication *)application { 28 | // 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. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | - (void)applicationWillEnterForeground:(UIApplication *)application { 33 | // 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. 34 | } 35 | 36 | - (void)applicationDidBecomeActive:(UIApplication *)application { 37 | // 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. 38 | } 39 | 40 | - (void)applicationWillTerminate:(UIApplication *)application { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /RTDragCellTableView/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // 4 | // Created by Rusted on 16/2/12. 5 | // Copyright © 2016年 Rusted. All rights reserved. 6 | // 7 | 8 | #import "ViewController.h" 9 | #import "RTDragCellTableView.h" 10 | #import "RTModel.h" 11 | #define RTColor(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0] 12 | #define RTRandomColor RTColor(arc4random_uniform(256), arc4random_uniform(256), arc4random_uniform(256)) 13 | @interface ViewController () 14 | @property (nonatomic, strong) NSArray *data; 15 | @end 16 | 17 | @implementation ViewController 18 | 19 | - (void)viewDidLoad { 20 | [super viewDidLoad]; 21 | // Do any additional setup after loading the view, typically from a nib. 22 | 23 | RTDragCellTableView *tableView = [[RTDragCellTableView alloc]init]; 24 | tableView.allowsSelection = YES; 25 | [self.view addSubview:tableView]; 26 | tableView.frame = self.view.bounds; 27 | tableView.dataSource = self; 28 | tableView.delegate = self; 29 | } 30 | 31 | - (NSArray *)data{ 32 | if (!_data) { 33 | NSMutableArray *arr = [NSMutableArray array]; 34 | int numberOfScections = 4; 35 | for (int i = 0; i < numberOfScections; i ++) { 36 | NSMutableArray *arr2 = [NSMutableArray array]; 37 | UIColor *color = RTRandomColor; 38 | for (int j = 0; j < 4 ; j ++) { 39 | RTModel *model = [[RTModel alloc]init]; 40 | model.title = [NSString stringWithFormat:@"%d - %d",i,j]; 41 | model.backgroundColor = color; 42 | [arr2 addObject:model]; 43 | } 44 | [arr addObject:arr2]; 45 | } 46 | _data = arr; 47 | } 48 | return _data; 49 | } 50 | 51 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ 52 | return self.data.count; 53 | } 54 | 55 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ 56 | NSArray *sec = _data[section]; 57 | return sec.count; 58 | } 59 | 60 | - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ 61 | return 30; 62 | } 63 | 64 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ 65 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"]; 66 | if (!cell) { 67 | cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"]; 68 | } 69 | RTModel *model = _data[indexPath.section][indexPath.item]; 70 | cell.backgroundColor = model.backgroundColor; 71 | cell.textLabel.text = model.title; 72 | cell.selectionStyle = UITableViewCellSelectionStyleNone; 73 | 74 | return cell; 75 | } 76 | 77 | - (NSArray *)originalArrayDataForTableView:(RTDragCellTableView *)tableView{ 78 | return _data; 79 | } 80 | 81 | - (void)tableView:(RTDragCellTableView *)tableView newArrayDataForDataSource:(NSArray *)newArray{ 82 | _data = newArray; 83 | } 84 | 85 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ 86 | return 80; 87 | } 88 | 89 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ 90 | RTModel *model = _data[indexPath.section][indexPath.row]; 91 | NSLog(@"%@",model.title); 92 | } 93 | 94 | 95 | @end 96 | -------------------------------------------------------------------------------- /RTDragCellTableView.xcodeproj/xcuserdata/mac.xcuserdatad/xcschemes/RTDragCellTableView.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /RTDragCellTableView.xcodeproj/xcuserdata/Rusted.xcuserdatad/xcschemes/RTDragCellTableView.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /RTDragCellTableView/RTDragCellTableView/RTDragCellTableView.m: -------------------------------------------------------------------------------- 1 | // 2 | // RTDragCellTableView.m 3 | // 4 | // Created by Rusted on 16/2/12. 5 | // Copyright © 2016年 Rusted. All rights reserved. 6 | // 7 | 8 | #import "RTDragCellTableView.h" 9 | typedef enum{ 10 | RTSnapshotMeetsEdgeTop, 11 | RTSnapshotMeetsEdgeBottom, 12 | }RTSnapshotMeetsEdge; 13 | 14 | @interface RTDragCellTableView () 15 | /**对被选中的cell的截图*/ 16 | @property (nonatomic, weak) UIView *snapshot; 17 | /**被选中的cell的原始位置*/ 18 | @property (nonatomic, strong) NSIndexPath *originalIndexPath; 19 | /**被选中的cell的新位置*/ 20 | @property (nonatomic, strong) NSIndexPath *relocatedIndexPath; 21 | /**cell被拖动到边缘后开启,tableview自动向上或向下滚动*/ 22 | @property (nonatomic, strong) CADisplayLink *autoScrollTimer; 23 | /**记录手指所在的位置*/ 24 | @property (nonatomic, assign) CGPoint fingerLocation; 25 | /**自动滚动的方向*/ 26 | @property (nonatomic, assign) RTSnapshotMeetsEdge autoScrollDirection; 27 | 28 | @end 29 | 30 | 31 | @implementation RTDragCellTableView 32 | 33 | @dynamic delegate; 34 | @dynamic dataSource; 35 | 36 | # pragma mark - initialization methods 37 | /**在初始化时加入一个长按手势*/ 38 | - (instancetype)init{ 39 | self = [super init]; 40 | if (self) { 41 | UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc]initWithTarget:self action:@selector(longPressGestureRecognized:)]; 42 | [self addGestureRecognizer:longPress]; 43 | } 44 | return self; 45 | } 46 | 47 | 48 | # pragma mark - Gesture methods 49 | 50 | - (void)longPressGestureRecognized:(id)sender{ 51 | UILongPressGestureRecognizer *longPress = (UILongPressGestureRecognizer *)sender; 52 | UIGestureRecognizerState longPressState = longPress.state; 53 | //手指在tableView中的位置 54 | _fingerLocation = [longPress locationInView:self]; 55 | //手指按住位置对应的indexPath,可能为nil 56 | _relocatedIndexPath = [self indexPathForRowAtPoint:_fingerLocation]; 57 | switch (longPressState) { 58 | case UIGestureRecognizerStateBegan:{ //手势开始,对被选中cell截图,隐藏原cell 59 | _originalIndexPath = [self indexPathForRowAtPoint:_fingerLocation]; 60 | if (_originalIndexPath) { 61 | [self cellSelectedAtIndexPath:_originalIndexPath]; 62 | } 63 | break; 64 | } 65 | case UIGestureRecognizerStateChanged:{//点击位置移动,判断手指按住位置是否进入其它indexPath范围,若进入则更新数据源并移动cell 66 | //截图跟随手指移动 67 | CGPoint center = _snapshot.center; 68 | center.y = _fingerLocation.y; 69 | _snapshot.center = center; 70 | if ([self checkIfSnapshotMeetsEdge]) { 71 | [self startAutoScrollTimer]; 72 | }else{ 73 | [self stopAutoScrollTimer]; 74 | } 75 | //手指按住位置对应的indexPath,可能为nil 76 | _relocatedIndexPath = [self indexPathForRowAtPoint:_fingerLocation]; 77 | if (_relocatedIndexPath && ![_relocatedIndexPath isEqual:_originalIndexPath]) { 78 | [self cellRelocatedToNewIndexPath:_relocatedIndexPath]; 79 | } 80 | break; 81 | } 82 | default: { //长按手势结束或被取消,移除截图,显示cell 83 | [self stopAutoScrollTimer]; 84 | [self didEndDraging]; 85 | break; 86 | } 87 | } 88 | } 89 | 90 | # pragma mark - timer methods 91 | /** 92 | * 创建定时器并运行 93 | */ 94 | - (void)startAutoScrollTimer{ 95 | if (!_autoScrollTimer) { 96 | _autoScrollTimer = [CADisplayLink displayLinkWithTarget:self selector:@selector(startAutoScroll)]; 97 | [_autoScrollTimer addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSRunLoopCommonModes]; 98 | } 99 | } 100 | /** 101 | * 停止定时器并销毁 102 | */ 103 | - (void)stopAutoScrollTimer{ 104 | if (_autoScrollTimer) { 105 | [_autoScrollTimer invalidate]; 106 | _autoScrollTimer = nil; 107 | } 108 | } 109 | 110 | # pragma mark - Private methods 111 | /**修改数据源,通知外部更新数据源*/ 112 | - (void)updateDataSource{ 113 | //通过DataSource代理获得原始数据源数组 114 | NSMutableArray *tempArray = [NSMutableArray array]; 115 | if ([self.dataSource respondsToSelector:@selector(originalArrayDataForTableView:)]) { 116 | [tempArray addObjectsFromArray:[self.dataSource originalArrayDataForTableView:self]]; 117 | } 118 | //判断原始数据源是否为嵌套数组 119 | if ([self nestedArrayCheck:tempArray]) {//是嵌套数组 120 | if (_originalIndexPath.section == _relocatedIndexPath.section) {//在同一个section内 121 | [self moveObjectInMutableArray:tempArray[_originalIndexPath.section] fromIndex:_originalIndexPath.row toIndex:_relocatedIndexPath.row]; 122 | }else{ //不在同一个section内 123 | id originalObj = tempArray[_originalIndexPath.section][_originalIndexPath.item]; 124 | [tempArray[_relocatedIndexPath.section] insertObject:originalObj atIndex:_relocatedIndexPath.item]; 125 | [tempArray[_originalIndexPath.section] removeObjectAtIndex:_originalIndexPath.item]; 126 | } 127 | }else{ //不是嵌套数组 128 | [self moveObjectInMutableArray:tempArray fromIndex:_originalIndexPath.row toIndex:_relocatedIndexPath.row]; 129 | } 130 | //将新数组传出外部以更改数据源 131 | if ([self.delegate respondsToSelector:@selector(tableView:newArrayDataForDataSource:)]) { 132 | [self.delegate tableView:self newArrayDataForDataSource:tempArray]; 133 | } 134 | } 135 | 136 | /** 137 | * 检查数组是否为嵌套数组 138 | * @param array 需要被检测的数组 139 | * @return 返回YES则表示是嵌套数组 140 | */ 141 | - (BOOL)nestedArrayCheck:(NSArray *)array{ 142 | for (id obj in array) { 143 | if ([obj isKindOfClass:[NSArray class]]) { 144 | return YES; 145 | } 146 | } 147 | return NO; 148 | } 149 | 150 | /** 151 | * cell被长按手指选中,对其进行截图,原cell隐藏 152 | */ 153 | - (void)cellSelectedAtIndexPath:(NSIndexPath *)indexPath{ 154 | UITableViewCell *cell = [self cellForRowAtIndexPath:indexPath]; 155 | UIView *snapshot = [self customSnapshotFromView:cell]; 156 | [self addSubview:snapshot]; 157 | _snapshot = snapshot; 158 | cell.hidden = YES; 159 | CGPoint center = _snapshot.center; 160 | center.y = _fingerLocation.y; 161 | [UIView animateWithDuration:0.2 animations:^{ 162 | _snapshot.transform = CGAffineTransformMakeScale(1.03, 1.03); 163 | _snapshot.alpha = 0.98; 164 | _snapshot.center = center; 165 | }]; 166 | } 167 | /** 168 | * 截图被移动到新的indexPath范围,这时先更新数据源,重排数组,再将cell移至新位置 169 | * @param indexPath 新的indexPath 170 | */ 171 | - (void)cellRelocatedToNewIndexPath:(NSIndexPath *)indexPath{ 172 | //更新数据源并返回给外部 173 | [self updateDataSource]; 174 | //交换移动cell位置 175 | [self moveRowAtIndexPath:_originalIndexPath toIndexPath:indexPath]; 176 | //更新cell的原始indexPath为当前indexPath 177 | _originalIndexPath = indexPath; 178 | } 179 | /** 180 | * 拖拽结束,显示cell,并移除截图 181 | */ 182 | - (void)didEndDraging{ 183 | UITableViewCell *cell = [self cellForRowAtIndexPath:_originalIndexPath]; 184 | cell.hidden = NO; 185 | cell.alpha = 0; 186 | [UIView animateWithDuration:0.2 animations:^{ 187 | _snapshot.center = cell.center; 188 | _snapshot.alpha = 0; 189 | _snapshot.transform = CGAffineTransformIdentity; 190 | cell.alpha = 1; 191 | } completion:^(BOOL finished) { 192 | cell.hidden = NO; 193 | [_snapshot removeFromSuperview]; 194 | _snapshot = nil; 195 | _originalIndexPath = nil; 196 | _relocatedIndexPath = nil; 197 | }]; 198 | } 199 | 200 | 201 | 202 | /** 返回一个给定view的截图. */ 203 | - (UIView *)customSnapshotFromView:(UIView *)inputView { 204 | 205 | // Make an image from the input view. 206 | UIGraphicsBeginImageContextWithOptions(inputView.bounds.size, NO, 0); 207 | [inputView.layer renderInContext:UIGraphicsGetCurrentContext()]; 208 | UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); 209 | UIGraphicsEndImageContext(); 210 | 211 | // Create an image view. 212 | UIView *snapshot = [[UIImageView alloc] initWithImage:image]; 213 | snapshot.center = inputView.center; 214 | snapshot.layer.masksToBounds = NO; 215 | snapshot.layer.cornerRadius = 0.0; 216 | snapshot.layer.shadowOffset = CGSizeMake(-5.0, 0.0); 217 | snapshot.layer.shadowRadius = 5.0; 218 | snapshot.layer.shadowOpacity = 0.4; 219 | 220 | return snapshot; 221 | } 222 | /** 223 | * 将可变数组中的一个对象移动到该数组中的另外一个位置 224 | * @param array 要变动的数组 225 | * @param fromIndex 从这个index 226 | * @param toIndex 移至这个index 227 | */ 228 | - (void)moveObjectInMutableArray:(NSMutableArray *)array fromIndex:(NSInteger)fromIndex toIndex:(NSInteger)toIndex{ 229 | if (fromIndex < toIndex) { 230 | for (NSInteger i = fromIndex; i < toIndex; i ++) { 231 | [array exchangeObjectAtIndex:i withObjectAtIndex:i + 1]; 232 | } 233 | }else{ 234 | for (NSInteger i = fromIndex; i > toIndex; i --) { 235 | [array exchangeObjectAtIndex:i withObjectAtIndex:i - 1]; 236 | } 237 | } 238 | } 239 | 240 | /** 241 | * 检查截图是否到达边缘,并作出响应 242 | */ 243 | - (BOOL)checkIfSnapshotMeetsEdge{ 244 | CGFloat minY = CGRectGetMinY(_snapshot.frame); 245 | CGFloat maxY = CGRectGetMaxY(_snapshot.frame); 246 | if (minY < self.contentOffset.y) { 247 | _autoScrollDirection = RTSnapshotMeetsEdgeTop; 248 | return YES; 249 | } 250 | if (maxY > self.bounds.size.height + self.contentOffset.y) { 251 | _autoScrollDirection = RTSnapshotMeetsEdgeBottom; 252 | return YES; 253 | } 254 | return NO; 255 | } 256 | /** 257 | * 开始自动滚动 258 | */ 259 | - (void)startAutoScroll{ 260 | CGFloat pixelSpeed = 4; 261 | if (_autoScrollDirection == RTSnapshotMeetsEdgeTop) {//向下滚动 262 | if (self.contentOffset.y > 0) {//向下滚动最大范围限制 263 | [self setContentOffset:CGPointMake(0, self.contentOffset.y - pixelSpeed)]; 264 | _snapshot.center = CGPointMake(_snapshot.center.x, _snapshot.center.y - pixelSpeed); 265 | } 266 | }else{ //向上滚动 267 | if (self.contentOffset.y + self.bounds.size.height < self.contentSize.height) {//向下滚动最大范围限制 268 | [self setContentOffset:CGPointMake(0, self.contentOffset.y + pixelSpeed)]; 269 | _snapshot.center = CGPointMake(_snapshot.center.x, _snapshot.center.y + pixelSpeed); 270 | } 271 | } 272 | 273 | /* 当把截图拖动到边缘,开始自动滚动,如果这时手指完全不动,则不会触发‘UIGestureRecognizerStateChanged’,对应的代码就不会执行,导致虽然截图在tableView中的位置变了,但并没有移动那个隐藏的cell,用下面代码可解决此问题,cell会随着截图的移动而移动 274 | */ 275 | _relocatedIndexPath = [self indexPathForRowAtPoint:_snapshot.center]; 276 | if (_relocatedIndexPath && ![_relocatedIndexPath isEqual:_originalIndexPath]) { 277 | [self cellRelocatedToNewIndexPath:_relocatedIndexPath]; 278 | } 279 | } 280 | @end 281 | -------------------------------------------------------------------------------- /RTDragCellTableView.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 14D0DF7E1C6EFF6900A10C10 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 14D0DF7D1C6EFF6900A10C10 /* main.m */; }; 11 | 14D0DF811C6EFF6900A10C10 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 14D0DF801C6EFF6900A10C10 /* AppDelegate.m */; }; 12 | 14D0DF871C6EFF6900A10C10 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 14D0DF851C6EFF6900A10C10 /* Main.storyboard */; }; 13 | 14D0DF891C6EFF6900A10C10 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 14D0DF881C6EFF6900A10C10 /* Assets.xcassets */; }; 14 | 14D0DF8C1C6EFF6900A10C10 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 14D0DF8A1C6EFF6900A10C10 /* LaunchScreen.storyboard */; }; 15 | 14D0DF961C6EFF9600A10C10 /* RTDragCellTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 14D0DF951C6EFF9600A10C10 /* RTDragCellTableView.m */; }; 16 | 14D0DF991C6EFF9F00A10C10 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 14D0DF981C6EFF9F00A10C10 /* ViewController.m */; }; 17 | 14D0DF9C1C6EFFAB00A10C10 /* RTModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 14D0DF9B1C6EFFAB00A10C10 /* RTModel.m */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXFileReference section */ 21 | 14D0DF791C6EFF6900A10C10 /* RTDragCellTableView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RTDragCellTableView.app; sourceTree = BUILT_PRODUCTS_DIR; }; 22 | 14D0DF7D1C6EFF6900A10C10 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 23 | 14D0DF7F1C6EFF6900A10C10 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 24 | 14D0DF801C6EFF6900A10C10 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 25 | 14D0DF861C6EFF6900A10C10 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 26 | 14D0DF881C6EFF6900A10C10 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 27 | 14D0DF8B1C6EFF6900A10C10 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 28 | 14D0DF8D1C6EFF6900A10C10 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 29 | 14D0DF941C6EFF9600A10C10 /* RTDragCellTableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTDragCellTableView.h; sourceTree = ""; }; 30 | 14D0DF951C6EFF9600A10C10 /* RTDragCellTableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RTDragCellTableView.m; sourceTree = ""; }; 31 | 14D0DF971C6EFF9F00A10C10 /* ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 32 | 14D0DF981C6EFF9F00A10C10 /* ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 33 | 14D0DF9A1C6EFFA500A10C10 /* RTModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RTModel.h; sourceTree = ""; }; 34 | 14D0DF9B1C6EFFAB00A10C10 /* RTModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RTModel.m; sourceTree = ""; }; 35 | /* End PBXFileReference section */ 36 | 37 | /* Begin PBXFrameworksBuildPhase section */ 38 | 14D0DF761C6EFF6900A10C10 /* Frameworks */ = { 39 | isa = PBXFrameworksBuildPhase; 40 | buildActionMask = 2147483647; 41 | files = ( 42 | ); 43 | runOnlyForDeploymentPostprocessing = 0; 44 | }; 45 | /* End PBXFrameworksBuildPhase section */ 46 | 47 | /* Begin PBXGroup section */ 48 | 14D0DF701C6EFF6900A10C10 = { 49 | isa = PBXGroup; 50 | children = ( 51 | 14D0DF7B1C6EFF6900A10C10 /* RTDragCellTableView */, 52 | 14D0DF7A1C6EFF6900A10C10 /* Products */, 53 | ); 54 | sourceTree = ""; 55 | }; 56 | 14D0DF7A1C6EFF6900A10C10 /* Products */ = { 57 | isa = PBXGroup; 58 | children = ( 59 | 14D0DF791C6EFF6900A10C10 /* RTDragCellTableView.app */, 60 | ); 61 | name = Products; 62 | sourceTree = ""; 63 | }; 64 | 14D0DF7B1C6EFF6900A10C10 /* RTDragCellTableView */ = { 65 | isa = PBXGroup; 66 | children = ( 67 | 14D0DF7F1C6EFF6900A10C10 /* AppDelegate.h */, 68 | 14D0DF801C6EFF6900A10C10 /* AppDelegate.m */, 69 | 14D0DF971C6EFF9F00A10C10 /* ViewController.h */, 70 | 14D0DF981C6EFF9F00A10C10 /* ViewController.m */, 71 | 14D0DF9A1C6EFFA500A10C10 /* RTModel.h */, 72 | 14D0DF9B1C6EFFAB00A10C10 /* RTModel.m */, 73 | 14D0DF931C6EFF9600A10C10 /* RTDragCellTableView */, 74 | 14D0DF851C6EFF6900A10C10 /* Main.storyboard */, 75 | 14D0DF881C6EFF6900A10C10 /* Assets.xcassets */, 76 | 14D0DF8A1C6EFF6900A10C10 /* LaunchScreen.storyboard */, 77 | 14D0DF8D1C6EFF6900A10C10 /* Info.plist */, 78 | 14D0DF7C1C6EFF6900A10C10 /* Supporting Files */, 79 | ); 80 | path = RTDragCellTableView; 81 | sourceTree = ""; 82 | }; 83 | 14D0DF7C1C6EFF6900A10C10 /* Supporting Files */ = { 84 | isa = PBXGroup; 85 | children = ( 86 | 14D0DF7D1C6EFF6900A10C10 /* main.m */, 87 | ); 88 | name = "Supporting Files"; 89 | sourceTree = ""; 90 | }; 91 | 14D0DF931C6EFF9600A10C10 /* RTDragCellTableView */ = { 92 | isa = PBXGroup; 93 | children = ( 94 | 14D0DF941C6EFF9600A10C10 /* RTDragCellTableView.h */, 95 | 14D0DF951C6EFF9600A10C10 /* RTDragCellTableView.m */, 96 | ); 97 | path = RTDragCellTableView; 98 | sourceTree = ""; 99 | }; 100 | /* End PBXGroup section */ 101 | 102 | /* Begin PBXNativeTarget section */ 103 | 14D0DF781C6EFF6900A10C10 /* RTDragCellTableView */ = { 104 | isa = PBXNativeTarget; 105 | buildConfigurationList = 14D0DF901C6EFF6900A10C10 /* Build configuration list for PBXNativeTarget "RTDragCellTableView" */; 106 | buildPhases = ( 107 | 14D0DF751C6EFF6900A10C10 /* Sources */, 108 | 14D0DF761C6EFF6900A10C10 /* Frameworks */, 109 | 14D0DF771C6EFF6900A10C10 /* Resources */, 110 | ); 111 | buildRules = ( 112 | ); 113 | dependencies = ( 114 | ); 115 | name = RTDragCellTableView; 116 | productName = RTDragCellTableView; 117 | productReference = 14D0DF791C6EFF6900A10C10 /* RTDragCellTableView.app */; 118 | productType = "com.apple.product-type.application"; 119 | }; 120 | /* End PBXNativeTarget section */ 121 | 122 | /* Begin PBXProject section */ 123 | 14D0DF711C6EFF6900A10C10 /* Project object */ = { 124 | isa = PBXProject; 125 | attributes = { 126 | LastUpgradeCheck = 0710; 127 | ORGANIZATIONNAME = Rusted; 128 | TargetAttributes = { 129 | 14D0DF781C6EFF6900A10C10 = { 130 | CreatedOnToolsVersion = 7.1; 131 | DevelopmentTeam = R9SGLQPBDE; 132 | }; 133 | }; 134 | }; 135 | buildConfigurationList = 14D0DF741C6EFF6900A10C10 /* Build configuration list for PBXProject "RTDragCellTableView" */; 136 | compatibilityVersion = "Xcode 3.2"; 137 | developmentRegion = English; 138 | hasScannedForEncodings = 0; 139 | knownRegions = ( 140 | en, 141 | Base, 142 | ); 143 | mainGroup = 14D0DF701C6EFF6900A10C10; 144 | productRefGroup = 14D0DF7A1C6EFF6900A10C10 /* Products */; 145 | projectDirPath = ""; 146 | projectRoot = ""; 147 | targets = ( 148 | 14D0DF781C6EFF6900A10C10 /* RTDragCellTableView */, 149 | ); 150 | }; 151 | /* End PBXProject section */ 152 | 153 | /* Begin PBXResourcesBuildPhase section */ 154 | 14D0DF771C6EFF6900A10C10 /* Resources */ = { 155 | isa = PBXResourcesBuildPhase; 156 | buildActionMask = 2147483647; 157 | files = ( 158 | 14D0DF8C1C6EFF6900A10C10 /* LaunchScreen.storyboard in Resources */, 159 | 14D0DF891C6EFF6900A10C10 /* Assets.xcassets in Resources */, 160 | 14D0DF871C6EFF6900A10C10 /* Main.storyboard in Resources */, 161 | ); 162 | runOnlyForDeploymentPostprocessing = 0; 163 | }; 164 | /* End PBXResourcesBuildPhase section */ 165 | 166 | /* Begin PBXSourcesBuildPhase section */ 167 | 14D0DF751C6EFF6900A10C10 /* Sources */ = { 168 | isa = PBXSourcesBuildPhase; 169 | buildActionMask = 2147483647; 170 | files = ( 171 | 14D0DF811C6EFF6900A10C10 /* AppDelegate.m in Sources */, 172 | 14D0DF9C1C6EFFAB00A10C10 /* RTModel.m in Sources */, 173 | 14D0DF7E1C6EFF6900A10C10 /* main.m in Sources */, 174 | 14D0DF991C6EFF9F00A10C10 /* ViewController.m in Sources */, 175 | 14D0DF961C6EFF9600A10C10 /* RTDragCellTableView.m in Sources */, 176 | ); 177 | runOnlyForDeploymentPostprocessing = 0; 178 | }; 179 | /* End PBXSourcesBuildPhase section */ 180 | 181 | /* Begin PBXVariantGroup section */ 182 | 14D0DF851C6EFF6900A10C10 /* Main.storyboard */ = { 183 | isa = PBXVariantGroup; 184 | children = ( 185 | 14D0DF861C6EFF6900A10C10 /* Base */, 186 | ); 187 | name = Main.storyboard; 188 | sourceTree = ""; 189 | }; 190 | 14D0DF8A1C6EFF6900A10C10 /* LaunchScreen.storyboard */ = { 191 | isa = PBXVariantGroup; 192 | children = ( 193 | 14D0DF8B1C6EFF6900A10C10 /* Base */, 194 | ); 195 | name = LaunchScreen.storyboard; 196 | sourceTree = ""; 197 | }; 198 | /* End PBXVariantGroup section */ 199 | 200 | /* Begin XCBuildConfiguration section */ 201 | 14D0DF8E1C6EFF6900A10C10 /* Debug */ = { 202 | isa = XCBuildConfiguration; 203 | buildSettings = { 204 | ALWAYS_SEARCH_USER_PATHS = NO; 205 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 206 | CLANG_CXX_LIBRARY = "libc++"; 207 | CLANG_ENABLE_MODULES = YES; 208 | CLANG_ENABLE_OBJC_ARC = YES; 209 | CLANG_WARN_BOOL_CONVERSION = YES; 210 | CLANG_WARN_CONSTANT_CONVERSION = YES; 211 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 212 | CLANG_WARN_EMPTY_BODY = YES; 213 | CLANG_WARN_ENUM_CONVERSION = YES; 214 | CLANG_WARN_INT_CONVERSION = YES; 215 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 216 | CLANG_WARN_UNREACHABLE_CODE = YES; 217 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 218 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 219 | COPY_PHASE_STRIP = NO; 220 | DEBUG_INFORMATION_FORMAT = dwarf; 221 | ENABLE_STRICT_OBJC_MSGSEND = YES; 222 | ENABLE_TESTABILITY = YES; 223 | GCC_C_LANGUAGE_STANDARD = gnu99; 224 | GCC_DYNAMIC_NO_PIC = NO; 225 | GCC_NO_COMMON_BLOCKS = YES; 226 | GCC_OPTIMIZATION_LEVEL = 0; 227 | GCC_PREPROCESSOR_DEFINITIONS = ( 228 | "DEBUG=1", 229 | "$(inherited)", 230 | ); 231 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 232 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 233 | GCC_WARN_UNDECLARED_SELECTOR = YES; 234 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 235 | GCC_WARN_UNUSED_FUNCTION = YES; 236 | GCC_WARN_UNUSED_VARIABLE = YES; 237 | IPHONEOS_DEPLOYMENT_TARGET = 9.1; 238 | MTL_ENABLE_DEBUG_INFO = YES; 239 | ONLY_ACTIVE_ARCH = YES; 240 | SDKROOT = iphoneos; 241 | TARGETED_DEVICE_FAMILY = "1,2"; 242 | }; 243 | name = Debug; 244 | }; 245 | 14D0DF8F1C6EFF6900A10C10 /* Release */ = { 246 | isa = XCBuildConfiguration; 247 | buildSettings = { 248 | ALWAYS_SEARCH_USER_PATHS = NO; 249 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 250 | CLANG_CXX_LIBRARY = "libc++"; 251 | CLANG_ENABLE_MODULES = YES; 252 | CLANG_ENABLE_OBJC_ARC = YES; 253 | CLANG_WARN_BOOL_CONVERSION = YES; 254 | CLANG_WARN_CONSTANT_CONVERSION = YES; 255 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 256 | CLANG_WARN_EMPTY_BODY = YES; 257 | CLANG_WARN_ENUM_CONVERSION = YES; 258 | CLANG_WARN_INT_CONVERSION = YES; 259 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 260 | CLANG_WARN_UNREACHABLE_CODE = YES; 261 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 262 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 263 | COPY_PHASE_STRIP = NO; 264 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 265 | ENABLE_NS_ASSERTIONS = NO; 266 | ENABLE_STRICT_OBJC_MSGSEND = YES; 267 | GCC_C_LANGUAGE_STANDARD = gnu99; 268 | GCC_NO_COMMON_BLOCKS = YES; 269 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 270 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 271 | GCC_WARN_UNDECLARED_SELECTOR = YES; 272 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 273 | GCC_WARN_UNUSED_FUNCTION = YES; 274 | GCC_WARN_UNUSED_VARIABLE = YES; 275 | IPHONEOS_DEPLOYMENT_TARGET = 9.1; 276 | MTL_ENABLE_DEBUG_INFO = NO; 277 | SDKROOT = iphoneos; 278 | TARGETED_DEVICE_FAMILY = "1,2"; 279 | VALIDATE_PRODUCT = YES; 280 | }; 281 | name = Release; 282 | }; 283 | 14D0DF911C6EFF6900A10C10 /* Debug */ = { 284 | isa = XCBuildConfiguration; 285 | buildSettings = { 286 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 287 | INFOPLIST_FILE = RTDragCellTableView/Info.plist; 288 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 289 | PRODUCT_BUNDLE_IDENTIFIER = Fzp.RTDragCellTableView; 290 | PRODUCT_NAME = "$(TARGET_NAME)"; 291 | }; 292 | name = Debug; 293 | }; 294 | 14D0DF921C6EFF6900A10C10 /* Release */ = { 295 | isa = XCBuildConfiguration; 296 | buildSettings = { 297 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 298 | INFOPLIST_FILE = RTDragCellTableView/Info.plist; 299 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 300 | PRODUCT_BUNDLE_IDENTIFIER = Fzp.RTDragCellTableView; 301 | PRODUCT_NAME = "$(TARGET_NAME)"; 302 | }; 303 | name = Release; 304 | }; 305 | /* End XCBuildConfiguration section */ 306 | 307 | /* Begin XCConfigurationList section */ 308 | 14D0DF741C6EFF6900A10C10 /* Build configuration list for PBXProject "RTDragCellTableView" */ = { 309 | isa = XCConfigurationList; 310 | buildConfigurations = ( 311 | 14D0DF8E1C6EFF6900A10C10 /* Debug */, 312 | 14D0DF8F1C6EFF6900A10C10 /* Release */, 313 | ); 314 | defaultConfigurationIsVisible = 0; 315 | defaultConfigurationName = Release; 316 | }; 317 | 14D0DF901C6EFF6900A10C10 /* Build configuration list for PBXNativeTarget "RTDragCellTableView" */ = { 318 | isa = XCConfigurationList; 319 | buildConfigurations = ( 320 | 14D0DF911C6EFF6900A10C10 /* Debug */, 321 | 14D0DF921C6EFF6900A10C10 /* Release */, 322 | ); 323 | defaultConfigurationIsVisible = 0; 324 | }; 325 | /* End XCConfigurationList section */ 326 | }; 327 | rootObject = 14D0DF711C6EFF6900A10C10 /* Project object */; 328 | } 329 | --------------------------------------------------------------------------------