├── .gitignore ├── LICENSE ├── LYSideslipCell.podspec ├── LYSideslipCell └── Classes │ ├── LYSideslipCell.h │ └── LYSideslipCell.m ├── LYSideslipCellDemo ├── LYSideslipCellDemo.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata └── LYSideslipCellDemo │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── Contents.json │ ├── Fav_Edit_Delete.imageset │ │ ├── Contents.json │ │ └── Fav_Edit_Delete.png │ ├── Fav_Edit_Tag.imageset │ │ ├── Contents.json │ │ └── Fav_Edit_Tag.png │ ├── ReadVerified_icon.imageset │ │ ├── Contents.json │ │ └── ReadVerified_icon.png │ ├── TabBar │ │ ├── Contents.json │ │ ├── tabbar_badge.imageset │ │ │ ├── Contents.json │ │ │ └── tabbar_badge.png │ │ ├── tabbar_contacts.imageset │ │ │ ├── Contents.json │ │ │ └── tabbar_contacts.png │ │ ├── tabbar_contactsHL.imageset │ │ │ ├── Contents.json │ │ │ └── tabbar_contactsHL.png │ │ ├── tabbar_discover.imageset │ │ │ ├── Contents.json │ │ │ └── tabbar_discover.png │ │ ├── tabbar_discoverHL.imageset │ │ │ ├── Contents.json │ │ │ └── tabbar_discoverHL.png │ │ ├── tabbar_mainframe.imageset │ │ │ ├── Contents.json │ │ │ └── tabbar_mainframe.png │ │ ├── tabbar_mainframeHL.imageset │ │ │ ├── Contents.json │ │ │ └── tabbar_mainframeHL.png │ │ ├── tabbar_me.imageset │ │ │ ├── Contents.json │ │ │ └── tabbar_me.png │ │ └── tabbar_meHL.imageset │ │ │ ├── Contents.json │ │ │ └── tabbar_meHL.png │ ├── add_friend_icon_offical.imageset │ │ ├── Contents.json │ │ └── add_friend_icon_offical.png │ ├── icon0.imageset │ │ ├── Contents.json │ │ └── icon0.jpeg │ ├── icon1.imageset │ │ ├── Contents.json │ │ └── icon1.jpg │ ├── icon2.imageset │ │ ├── Contents.json │ │ └── icon2.jpeg │ ├── icon3.imageset │ │ ├── Contents.json │ │ └── icon3.jpeg │ ├── icon4.imageset │ │ ├── Contents.json │ │ └── icon4.jpg │ └── login_logo.imageset │ │ ├── Contents.json │ │ └── login_logo.png │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Contact │ ├── LYContactCell.h │ ├── LYContactCell.m │ ├── LYContactViewController.h │ └── LYContactViewController.m │ ├── Favorite │ ├── LYFavoriteCell.h │ ├── LYFavoriteCell.m │ ├── LYFavoriteViewController.h │ └── LYFavoriteViewController.m │ ├── Home │ ├── LYHomeCell.h │ ├── LYHomeCell.m │ ├── LYHomeCellModel.h │ ├── LYHomeCellModel.m │ ├── LYHomeViewController.h │ └── LYHomeViewController.m │ ├── Info.plist │ └── main.m └── 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 | *.moved-aside 22 | *.xcuserstate 23 | 24 | ## Obj-C/Swift specific 25 | *.hmap 26 | *.ipa 27 | *.dSYM.zip 28 | *.dSYM 29 | 30 | # CocoaPods 31 | # 32 | # We recommend against adding the Pods directory to your .gitignore. However 33 | # you should judge for yourself, the pros and cons are mentioned at: 34 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 35 | # 36 | # Pods/ 37 | 38 | # Carthage 39 | # 40 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 41 | # Carthage/Checkouts 42 | 43 | Carthage/Build 44 | 45 | # fastlane 46 | # 47 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 48 | # screenshots whenever they are needed. 49 | # For more information about the recommended setup visit: 50 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md 51 | 52 | fastlane/report.xml 53 | fastlane/screenshots 54 | 55 | #Code Injection 56 | # 57 | # After new code Injection tools there's a generated folder /iOSInjectionProject 58 | # https://github.com/johnno1962/injectionforxcode 59 | 60 | iOSInjectionProject/ 61 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Louis 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 | -------------------------------------------------------------------------------- /LYSideslipCell.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "LYSideslipCell" 3 | s.version = "1.1.2" 4 | s.summary = "A tableViewCell like WeChat" 5 | s.homepage = "https://github.com/louis-ly/LYSideslipCell" 6 | s.license = "MIT" 7 | s.frameworks = "UIKit" 8 | s.platform = :ios, '6.0' 9 | s.author = { "louisly" => "396868934@qq.com" } 10 | s.source = { :git => "https://github.com/louis-ly/LYSideslipCell.git", :tag => s.version } 11 | s.source_files = 'LYSideslipCell/Classes/*.{h,m}' 12 | s.requires_arc = true 13 | end 14 | -------------------------------------------------------------------------------- /LYSideslipCell/Classes/LYSideslipCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // LYSideslipCell.h 3 | // LYSideslipCellDemo 4 | // 5 | // Created by Louis on 16/7/5. 6 | // Copyright © 2016年 Louis. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | typedef NS_ENUM(NSInteger, LYSideslipCellActionStyle) { 14 | LYSideslipCellActionStyleDefault = 0, 15 | LYSideslipCellActionStyleDestructive = LYSideslipCellActionStyleDefault, // 删除 红底 16 | LYSideslipCellActionStyleNormal // 正常 灰底 17 | }; 18 | 19 | @interface LYSideslipCellAction : NSObject 20 | + (instancetype)rowActionWithStyle:(LYSideslipCellActionStyle)style title:(nullable NSString *)title handler:(void (^)(LYSideslipCellAction *action, NSIndexPath *indexPath))handler; 21 | @property (nonatomic, readonly) LYSideslipCellActionStyle style; 22 | @property (nonatomic, copy, nullable) NSString *title; // 文字内容 23 | @property (nonatomic, strong, nullable) UIImage *image; // 按钮图片. 默认无图 24 | @property (nonatomic, assign) CGFloat fontSize; // 字体大小. 默认17 25 | @property (nonatomic, strong, nullable) UIColor *titleColor; // 文字颜色. 默认白色 26 | @property (nonatomic, copy, nullable) UIColor *backgroundColor; // 背景颜色. 默认透明 27 | @property (nonatomic, assign) CGFloat margin; // 内容左右间距. 默认15 28 | @end 29 | 30 | @class LYSideslipCell; 31 | @protocol LYSideslipCellDelegate 32 | @optional; 33 | /** 34 | * 选中了侧滑按钮 35 | * 36 | * @param sideslipCell 当前响应的cell 37 | * @param indexPath cell在tableView中的位置 38 | * @param index 选中的是第几个action 39 | */ 40 | - (void)sideslipCell:(LYSideslipCell *)sideslipCell rowAtIndexPath:(NSIndexPath *)indexPath didSelectedAtIndex:(NSInteger)index; 41 | 42 | /** 43 | * 告知当前位置的cell是否需要侧滑按钮 44 | * 45 | * @param sideslipCell 当前响应的cell 46 | * @param indexPath cell在tableView中的位置 47 | * 48 | * @return YES 表示当前cell可以侧滑, NO 不可以 49 | */ 50 | - (BOOL)sideslipCell:(LYSideslipCell *)sideslipCell canSideslipRowAtIndexPath:(NSIndexPath *)indexPath; 51 | 52 | /** 53 | * 返回侧滑事件 54 | * 55 | * @param sideslipCell 当前响应的cell 56 | * @param indexPath cell在tableView中的位置 57 | * 58 | * @return 数组为空, 则没有侧滑事件 59 | */ 60 | - (nullable NSArray *)sideslipCell:(LYSideslipCell *)sideslipCell editActionsForRowAtIndexPath:(NSIndexPath *)indexPath; 61 | @end 62 | 63 | 64 | @interface LYSideslipCell : UITableViewCell 65 | 66 | @property (nonatomic, weak) id delegate; 67 | 68 | /** 69 | * 按钮容器 70 | */ 71 | @property (nonatomic, strong) UIView *btnContainView; 72 | 73 | /** 74 | * 隐藏侧滑按钮 75 | */ 76 | - (void)hiddenAllSideslip; 77 | - (void)hiddenSideslip; 78 | @end 79 | 80 | 81 | @interface UITableView (LYSideslipCell) 82 | - (void)hiddenAllSideslip; 83 | @end 84 | 85 | NS_ASSUME_NONNULL_END 86 | -------------------------------------------------------------------------------- /LYSideslipCell/Classes/LYSideslipCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // LYSideslipCell.m 3 | // LYSideslipCellDemo 4 | // 5 | // Created by Louis on 16/7/5. 6 | // Copyright © 2016年 Louis. All rights reserved. 7 | // 8 | 9 | #import "LYSideslipCell.h" 10 | 11 | @interface LYSideslipCellAction () 12 | @property (nonatomic, copy) void (^handler)(LYSideslipCellAction *action, NSIndexPath *indexPath); 13 | @property (nonatomic, assign) LYSideslipCellActionStyle style; 14 | @end 15 | @implementation LYSideslipCellAction 16 | + (instancetype)rowActionWithStyle:(LYSideslipCellActionStyle)style title:(NSString *)title handler:(void (^)(LYSideslipCellAction *action, NSIndexPath *indexPath))handler { 17 | LYSideslipCellAction *action = [LYSideslipCellAction new]; 18 | action.title = title; 19 | action.handler = handler; 20 | action.style = style; 21 | return action; 22 | } 23 | 24 | - (CGFloat)margin { 25 | return _margin == 0 ? 15 : _margin; 26 | } 27 | @end 28 | 29 | typedef NS_ENUM(NSInteger, LYSideslipCellState) { 30 | LYSideslipCellStateNormal, 31 | LYSideslipCellStateAnimating, 32 | LYSideslipCellStateOpen 33 | }; 34 | 35 | @interface LYSideslipCell () 36 | @property (nonatomic, assign) BOOL sideslip; 37 | @property (nonatomic, assign) LYSideslipCellState state; 38 | @end 39 | 40 | @implementation LYSideslipCell { 41 | UITableView *_tableView; 42 | NSArray * _actions; 43 | UIPanGestureRecognizer *_panGesture; 44 | UIPanGestureRecognizer *_tableViewPan; 45 | } 46 | 47 | #pragma mark - Life Cycle 48 | - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { 49 | if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { 50 | [self setupSideslipCell]; 51 | } 52 | return self; 53 | } 54 | 55 | - (instancetype)initWithCoder:(NSCoder *)aDecoder { 56 | if (self = [super initWithCoder:aDecoder]) { 57 | [self setupSideslipCell]; 58 | } 59 | return self; 60 | } 61 | 62 | - (void)setupSideslipCell { 63 | _panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(contentViewPan:)]; 64 | _panGesture.delegate = self; 65 | [self.contentView addGestureRecognizer:_panGesture]; 66 | self.contentView.backgroundColor = [UIColor whiteColor]; 67 | } 68 | 69 | - (void)layoutSubviews { 70 | CGFloat x = 0; 71 | if (_sideslip) x = self.contentView.frame.origin.x; 72 | 73 | [super layoutSubviews]; 74 | CGFloat totalWidth = 0; 75 | for (UIButton *btn in _btnContainView.subviews) { 76 | btn.frame = CGRectMake(totalWidth, 0, btn.frame.size.width, self.frame.size.height); 77 | totalWidth += btn.frame.size.width; 78 | } 79 | _btnContainView.frame = CGRectMake(self.frame.size.width - totalWidth, 0, totalWidth, self.frame.size.height); 80 | 81 | // 侧滑状态旋转屏幕时, 保持侧滑 82 | if (_sideslip) [self setContentViewX:x]; 83 | 84 | CGRect frame = self.contentView.frame; 85 | frame.size.width = self.bounds.size.width; 86 | self.contentView.frame = frame; 87 | } 88 | 89 | - (void)prepareForReuse { 90 | [super prepareForReuse]; 91 | if (_sideslip) [self hiddenSideslip]; 92 | } 93 | 94 | #pragma mark - UIGestureRecognizerDelegate 95 | - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer { 96 | if (gestureRecognizer == _panGesture) { 97 | // 若 tableView 不能滚动时, 还触发手势, 则隐藏侧滑 98 | if (!self.tableView.scrollEnabled) { 99 | [self hiddenAllSideslip]; 100 | return NO; 101 | } 102 | UIPanGestureRecognizer *gesture = (UIPanGestureRecognizer *)gestureRecognizer; 103 | CGPoint translation = [gesture translationInView:gesture.view]; 104 | 105 | // 如果手势相对于水平方向的角度大于45°, 则不触发侧滑 106 | BOOL shouldBegin = fabs(translation.y) <= fabs(translation.x); 107 | if (!shouldBegin) return NO; 108 | 109 | // 询问代理是否需要侧滑 110 | if ([_delegate respondsToSelector:@selector(sideslipCell:canSideslipRowAtIndexPath:)]) { 111 | shouldBegin = [_delegate sideslipCell:self canSideslipRowAtIndexPath:self.indexPath] || _sideslip; 112 | } 113 | 114 | if (shouldBegin) { 115 | // 向代理获取侧滑展示内容数组 116 | if ([_delegate respondsToSelector:@selector(sideslipCell:editActionsForRowAtIndexPath:)]) { 117 | NSArray *actions = [_delegate sideslipCell:self editActionsForRowAtIndexPath:self.indexPath]; 118 | if (!actions || actions.count == 0) return NO; 119 | [self setActions:actions]; 120 | } else { 121 | return NO; 122 | } 123 | } 124 | return shouldBegin; 125 | } else if (gestureRecognizer == _tableViewPan) { 126 | if (self.tableView.scrollEnabled) { 127 | return NO; 128 | } 129 | } 130 | return YES; 131 | } 132 | 133 | #pragma mark - Response Events 134 | - (void)tableViewPan:(UIPanGestureRecognizer *)pan { 135 | if (!self.tableView.scrollEnabled && pan.state == UIGestureRecognizerStateBegan) { 136 | [self hiddenAllSideslip]; 137 | } 138 | } 139 | 140 | - (void)contentViewPan:(UIPanGestureRecognizer *)pan { 141 | CGPoint point = [pan translationInView:pan.view]; 142 | UIGestureRecognizerState state = pan.state; 143 | [pan setTranslation:CGPointZero inView:pan.view]; 144 | 145 | if (state == UIGestureRecognizerStateChanged) { 146 | CGRect frame = self.contentView.frame; 147 | frame.origin.x += point.x; 148 | if (frame.origin.x > 15) { 149 | frame.origin.x = 15; 150 | } else if (frame.origin.x < -30 - _btnContainView.frame.size.width) { 151 | frame.origin.x = -30 - _btnContainView.frame.size.width; 152 | } 153 | self.contentView.frame = frame; 154 | 155 | } else if (state == UIGestureRecognizerStateEnded) { 156 | CGPoint velocity = [pan velocityInView:pan.view]; 157 | if (self.contentView.frame.origin.x == 0) { 158 | return; 159 | } else if (self.contentView.frame.origin.x > 5) { 160 | [self hiddenWithBounceAnimation]; 161 | } else if (fabs(self.contentView.frame.origin.x) >= 40 && velocity.x <= 0) { 162 | [self showSideslip]; 163 | } else { 164 | [self hiddenSideslip]; 165 | } 166 | 167 | } else if (state == UIGestureRecognizerStateCancelled) { 168 | [self hiddenAllSideslip]; 169 | } 170 | } 171 | 172 | - (void)actionBtnDidClicked:(UIButton *)btn { 173 | if ([self.delegate respondsToSelector:@selector(sideslipCell:rowAtIndexPath:didSelectedAtIndex:)]) { 174 | [self.delegate sideslipCell:self rowAtIndexPath:self.indexPath didSelectedAtIndex:btn.tag]; 175 | } 176 | if (btn.tag < _actions.count) { 177 | LYSideslipCellAction *action = _actions[btn.tag]; 178 | if (action.handler) action.handler(action, self.indexPath); 179 | } 180 | self.state = LYSideslipCellStateNormal; 181 | } 182 | 183 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { 184 | [super touchesBegan:touches withEvent:event]; 185 | if (_sideslip) [self hiddenAllSideslip]; 186 | } 187 | 188 | #pragma mark - Methods 189 | - (void)hiddenWithBounceAnimation { 190 | self.state = LYSideslipCellStateAnimating; 191 | [UIView animateWithDuration:0.25 delay:0 options:UIViewAnimationOptionCurveLinear animations:^{ 192 | [self setContentViewX:-10]; 193 | } completion:^(BOOL finished) { 194 | [self hiddenSideslip]; 195 | }]; 196 | } 197 | 198 | - (void)hiddenAllSideslip { 199 | [self.tableView hiddenAllSideslip]; 200 | } 201 | 202 | - (void)hiddenSideslip { 203 | if (self.contentView.frame.origin.x == 0) return; 204 | 205 | self.state = LYSideslipCellStateAnimating; 206 | [UIView animateWithDuration:0.2 delay:0 options:UIViewAnimationOptionCurveLinear animations:^{ 207 | [self setContentViewX:0]; 208 | } completion:^(BOOL finished) { 209 | [_btnContainView removeFromSuperview]; 210 | _btnContainView = nil; 211 | self.state = LYSideslipCellStateNormal; 212 | }]; 213 | } 214 | 215 | - (void)showSideslip { 216 | self.state = LYSideslipCellStateAnimating; 217 | [UIView animateWithDuration:0.2 delay:0 options:UIViewAnimationOptionCurveLinear animations:^{ 218 | [self setContentViewX:-_btnContainView.frame.size.width]; 219 | } completion:^(BOOL finished) { 220 | self.state = LYSideslipCellStateOpen; 221 | }]; 222 | } 223 | 224 | #pragma mark - Setter 225 | - (void)setContentViewX:(CGFloat)x { 226 | CGRect frame = self.contentView.frame; 227 | frame.origin.x = x; 228 | self.contentView.frame = frame; 229 | } 230 | 231 | - (void)setActions:(NSArray *)actions { 232 | _actions = actions; 233 | 234 | if (_btnContainView) { 235 | [_btnContainView removeFromSuperview]; 236 | _btnContainView = nil; 237 | } 238 | _btnContainView = [UIView new]; 239 | [self insertSubview:_btnContainView belowSubview:self.contentView]; 240 | 241 | for (int i = 0; i < actions.count; i++) { 242 | LYSideslipCellAction *action = actions[i]; 243 | UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; 244 | btn.adjustsImageWhenHighlighted = NO; 245 | 246 | [btn setTitle:action.title forState:UIControlStateNormal]; 247 | 248 | if (action.backgroundColor) { 249 | btn.backgroundColor = action.backgroundColor; 250 | } else { 251 | btn.backgroundColor = action.style == LYSideslipCellActionStyleNormal? [UIColor colorWithRed:200/255.0 green:199/255.0 blue:205/255.0 alpha:1] : [UIColor redColor]; 252 | } 253 | 254 | if (action.image) { 255 | [btn setImage:action.image forState:UIControlStateNormal]; 256 | } 257 | 258 | if (action.fontSize != 0) { 259 | btn.titleLabel.font = [UIFont systemFontOfSize:action.fontSize]; 260 | } 261 | 262 | if (action.titleColor) { 263 | [btn setTitleColor:action.titleColor forState:UIControlStateNormal]; 264 | } 265 | 266 | CGFloat width = [action.title boundingRectWithSize:CGSizeMake(MAXFLOAT, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName : btn.titleLabel.font} context:nil].size.width; 267 | width += (action.image ? action.image.size.width : 0); 268 | btn.frame = CGRectMake(0, 0, width + action.margin*2, self.frame.size.height); 269 | 270 | btn.tag = i; 271 | [btn addTarget:self action:@selector(actionBtnDidClicked:) forControlEvents:UIControlEventTouchUpInside]; 272 | [_btnContainView addSubview:btn]; 273 | } 274 | } 275 | 276 | - (void)setState:(LYSideslipCellState)state { 277 | _state = state; 278 | 279 | if (state == LYSideslipCellStateNormal) { 280 | self.tableView.scrollEnabled = YES; 281 | self.tableView.allowsSelection = YES; 282 | for (LYSideslipCell *cell in self.tableView.visibleCells) { 283 | if ([cell isKindOfClass:LYSideslipCell.class]) { 284 | cell.sideslip = NO; 285 | } 286 | } 287 | 288 | } else if (state == LYSideslipCellStateAnimating) { 289 | 290 | } else if (state == LYSideslipCellStateOpen) { 291 | self.tableView.scrollEnabled = NO; 292 | self.tableView.allowsSelection = NO; 293 | for (LYSideslipCell *cell in self.tableView.visibleCells) { 294 | if ([cell isKindOfClass:LYSideslipCell.class]) { 295 | cell.sideslip = YES; 296 | } 297 | } 298 | } 299 | } 300 | 301 | #pragma mark - Getter 302 | - (UITableView *)tableView { 303 | if (!_tableView) { 304 | id view = self.superview; 305 | while (view && [view isKindOfClass:[UITableView class]] == NO) { 306 | view = [view superview]; 307 | } 308 | _tableView = (UITableView *)view; 309 | _tableViewPan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(tableViewPan:)]; 310 | _tableViewPan.delegate = self; 311 | [_tableView addGestureRecognizer:_tableViewPan]; 312 | } 313 | return _tableView; 314 | } 315 | 316 | - (NSIndexPath *)indexPath { 317 | return [self.tableView indexPathForCell:self]; 318 | } 319 | @end 320 | 321 | 322 | @implementation UITableView (LYSideslipCell) 323 | - (void)hiddenAllSideslip { 324 | for (LYSideslipCell *cell in self.visibleCells) { 325 | if ([cell isKindOfClass:LYSideslipCell.class]) { 326 | [cell hiddenSideslip]; 327 | } 328 | } 329 | } 330 | @end 331 | -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | BF8C561C1D3497F30003550C /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = BF8C561B1D3497F30003550C /* main.m */; }; 11 | BF8C561F1D3497F30003550C /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = BF8C561E1D3497F30003550C /* AppDelegate.m */; }; 12 | BF8C56251D3497F30003550C /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BF8C56231D3497F30003550C /* Main.storyboard */; }; 13 | BF8C56271D3497F30003550C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BF8C56261D3497F30003550C /* Assets.xcassets */; }; 14 | BF8C562A1D3497F30003550C /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BF8C56281D3497F30003550C /* LaunchScreen.storyboard */; }; 15 | BF8C56421D34981B0003550C /* LYContactCell.m in Sources */ = {isa = PBXBuildFile; fileRef = BF8C56331D34981B0003550C /* LYContactCell.m */; }; 16 | BF8C56431D34981B0003550C /* LYContactViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BF8C56351D34981B0003550C /* LYContactViewController.m */; }; 17 | BF8C56441D34981B0003550C /* LYFavoriteCell.m in Sources */ = {isa = PBXBuildFile; fileRef = BF8C56381D34981B0003550C /* LYFavoriteCell.m */; }; 18 | BF8C56451D34981B0003550C /* LYFavoriteViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BF8C563A1D34981B0003550C /* LYFavoriteViewController.m */; }; 19 | BF8C56461D34981B0003550C /* LYHomeCell.m in Sources */ = {isa = PBXBuildFile; fileRef = BF8C563D1D34981B0003550C /* LYHomeCell.m */; }; 20 | BF8C56471D34981B0003550C /* LYHomeCellModel.m in Sources */ = {isa = PBXBuildFile; fileRef = BF8C563F1D34981B0003550C /* LYHomeCellModel.m */; }; 21 | BF8C56481D34981B0003550C /* LYHomeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BF8C56411D34981B0003550C /* LYHomeViewController.m */; }; 22 | BF8C56541D35D8A70003550C /* LYSideslipCell.m in Sources */ = {isa = PBXBuildFile; fileRef = BF8C56531D35D8A70003550C /* LYSideslipCell.m */; }; 23 | /* End PBXBuildFile section */ 24 | 25 | /* Begin PBXFileReference section */ 26 | BF8C56171D3497F30003550C /* LYSideslipCellDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LYSideslipCellDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 27 | BF8C561B1D3497F30003550C /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 28 | BF8C561D1D3497F30003550C /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 29 | BF8C561E1D3497F30003550C /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 30 | BF8C56241D3497F30003550C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 31 | BF8C56261D3497F30003550C /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 32 | BF8C56291D3497F30003550C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 33 | BF8C562B1D3497F30003550C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 34 | BF8C56321D34981B0003550C /* LYContactCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LYContactCell.h; sourceTree = ""; }; 35 | BF8C56331D34981B0003550C /* LYContactCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LYContactCell.m; sourceTree = ""; }; 36 | BF8C56341D34981B0003550C /* LYContactViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LYContactViewController.h; sourceTree = ""; }; 37 | BF8C56351D34981B0003550C /* LYContactViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LYContactViewController.m; sourceTree = ""; }; 38 | BF8C56371D34981B0003550C /* LYFavoriteCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LYFavoriteCell.h; sourceTree = ""; }; 39 | BF8C56381D34981B0003550C /* LYFavoriteCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LYFavoriteCell.m; sourceTree = ""; }; 40 | BF8C56391D34981B0003550C /* LYFavoriteViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LYFavoriteViewController.h; sourceTree = ""; }; 41 | BF8C563A1D34981B0003550C /* LYFavoriteViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LYFavoriteViewController.m; sourceTree = ""; }; 42 | BF8C563C1D34981B0003550C /* LYHomeCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LYHomeCell.h; sourceTree = ""; }; 43 | BF8C563D1D34981B0003550C /* LYHomeCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LYHomeCell.m; sourceTree = ""; }; 44 | BF8C563E1D34981B0003550C /* LYHomeCellModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LYHomeCellModel.h; sourceTree = ""; }; 45 | BF8C563F1D34981B0003550C /* LYHomeCellModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LYHomeCellModel.m; sourceTree = ""; }; 46 | BF8C56401D34981B0003550C /* LYHomeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LYHomeViewController.h; sourceTree = ""; }; 47 | BF8C56411D34981B0003550C /* LYHomeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LYHomeViewController.m; sourceTree = ""; }; 48 | BF8C56521D35D8A70003550C /* LYSideslipCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LYSideslipCell.h; sourceTree = ""; }; 49 | BF8C56531D35D8A70003550C /* LYSideslipCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LYSideslipCell.m; sourceTree = ""; }; 50 | /* End PBXFileReference section */ 51 | 52 | /* Begin PBXFrameworksBuildPhase section */ 53 | BF8C56141D3497F30003550C /* Frameworks */ = { 54 | isa = PBXFrameworksBuildPhase; 55 | buildActionMask = 2147483647; 56 | files = ( 57 | ); 58 | runOnlyForDeploymentPostprocessing = 0; 59 | }; 60 | /* End PBXFrameworksBuildPhase section */ 61 | 62 | /* Begin PBXGroup section */ 63 | BF8C560E1D3497F30003550C = { 64 | isa = PBXGroup; 65 | children = ( 66 | BF8C56191D3497F30003550C /* LYSideslipCellDemo */, 67 | BF8C56181D3497F30003550C /* Products */, 68 | ); 69 | sourceTree = ""; 70 | }; 71 | BF8C56181D3497F30003550C /* Products */ = { 72 | isa = PBXGroup; 73 | children = ( 74 | BF8C56171D3497F30003550C /* LYSideslipCellDemo.app */, 75 | ); 76 | name = Products; 77 | sourceTree = ""; 78 | }; 79 | BF8C56191D3497F30003550C /* LYSideslipCellDemo */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | BF8C56511D35D8A70003550C /* Classes */, 83 | BF8C56311D34981B0003550C /* Contact */, 84 | BF8C56361D34981B0003550C /* Favorite */, 85 | BF8C563B1D34981B0003550C /* Home */, 86 | BF8C561D1D3497F30003550C /* AppDelegate.h */, 87 | BF8C561E1D3497F30003550C /* AppDelegate.m */, 88 | BF8C56231D3497F30003550C /* Main.storyboard */, 89 | BF8C56261D3497F30003550C /* Assets.xcassets */, 90 | BF8C56281D3497F30003550C /* LaunchScreen.storyboard */, 91 | BF8C562B1D3497F30003550C /* Info.plist */, 92 | BF8C561A1D3497F30003550C /* Supporting Files */, 93 | ); 94 | path = LYSideslipCellDemo; 95 | sourceTree = ""; 96 | }; 97 | BF8C561A1D3497F30003550C /* Supporting Files */ = { 98 | isa = PBXGroup; 99 | children = ( 100 | BF8C561B1D3497F30003550C /* main.m */, 101 | ); 102 | name = "Supporting Files"; 103 | sourceTree = ""; 104 | }; 105 | BF8C56311D34981B0003550C /* Contact */ = { 106 | isa = PBXGroup; 107 | children = ( 108 | BF8C56321D34981B0003550C /* LYContactCell.h */, 109 | BF8C56331D34981B0003550C /* LYContactCell.m */, 110 | BF8C56341D34981B0003550C /* LYContactViewController.h */, 111 | BF8C56351D34981B0003550C /* LYContactViewController.m */, 112 | ); 113 | path = Contact; 114 | sourceTree = ""; 115 | }; 116 | BF8C56361D34981B0003550C /* Favorite */ = { 117 | isa = PBXGroup; 118 | children = ( 119 | BF8C56371D34981B0003550C /* LYFavoriteCell.h */, 120 | BF8C56381D34981B0003550C /* LYFavoriteCell.m */, 121 | BF8C56391D34981B0003550C /* LYFavoriteViewController.h */, 122 | BF8C563A1D34981B0003550C /* LYFavoriteViewController.m */, 123 | ); 124 | path = Favorite; 125 | sourceTree = ""; 126 | }; 127 | BF8C563B1D34981B0003550C /* Home */ = { 128 | isa = PBXGroup; 129 | children = ( 130 | BF8C563C1D34981B0003550C /* LYHomeCell.h */, 131 | BF8C563D1D34981B0003550C /* LYHomeCell.m */, 132 | BF8C563E1D34981B0003550C /* LYHomeCellModel.h */, 133 | BF8C563F1D34981B0003550C /* LYHomeCellModel.m */, 134 | BF8C56401D34981B0003550C /* LYHomeViewController.h */, 135 | BF8C56411D34981B0003550C /* LYHomeViewController.m */, 136 | ); 137 | path = Home; 138 | sourceTree = ""; 139 | }; 140 | BF8C56511D35D8A70003550C /* Classes */ = { 141 | isa = PBXGroup; 142 | children = ( 143 | BF8C56521D35D8A70003550C /* LYSideslipCell.h */, 144 | BF8C56531D35D8A70003550C /* LYSideslipCell.m */, 145 | ); 146 | name = Classes; 147 | path = ../../LYSideslipCell/Classes; 148 | sourceTree = ""; 149 | }; 150 | /* End PBXGroup section */ 151 | 152 | /* Begin PBXNativeTarget section */ 153 | BF8C56161D3497F30003550C /* LYSideslipCellDemo */ = { 154 | isa = PBXNativeTarget; 155 | buildConfigurationList = BF8C562E1D3497F30003550C /* Build configuration list for PBXNativeTarget "LYSideslipCellDemo" */; 156 | buildPhases = ( 157 | BF8C56131D3497F30003550C /* Sources */, 158 | BF8C56141D3497F30003550C /* Frameworks */, 159 | BF8C56151D3497F30003550C /* Resources */, 160 | ); 161 | buildRules = ( 162 | ); 163 | dependencies = ( 164 | ); 165 | name = LYSideslipCellDemo; 166 | productName = LYSideslipCellDemo; 167 | productReference = BF8C56171D3497F30003550C /* LYSideslipCellDemo.app */; 168 | productType = "com.apple.product-type.application"; 169 | }; 170 | /* End PBXNativeTarget section */ 171 | 172 | /* Begin PBXProject section */ 173 | BF8C560F1D3497F30003550C /* Project object */ = { 174 | isa = PBXProject; 175 | attributes = { 176 | LastUpgradeCheck = 0820; 177 | ORGANIZATIONNAME = Louis; 178 | TargetAttributes = { 179 | BF8C56161D3497F30003550C = { 180 | CreatedOnToolsVersion = 7.3; 181 | }; 182 | }; 183 | }; 184 | buildConfigurationList = BF8C56121D3497F30003550C /* Build configuration list for PBXProject "LYSideslipCellDemo" */; 185 | compatibilityVersion = "Xcode 3.2"; 186 | developmentRegion = English; 187 | hasScannedForEncodings = 0; 188 | knownRegions = ( 189 | en, 190 | Base, 191 | ); 192 | mainGroup = BF8C560E1D3497F30003550C; 193 | productRefGroup = BF8C56181D3497F30003550C /* Products */; 194 | projectDirPath = ""; 195 | projectRoot = ""; 196 | targets = ( 197 | BF8C56161D3497F30003550C /* LYSideslipCellDemo */, 198 | ); 199 | }; 200 | /* End PBXProject section */ 201 | 202 | /* Begin PBXResourcesBuildPhase section */ 203 | BF8C56151D3497F30003550C /* Resources */ = { 204 | isa = PBXResourcesBuildPhase; 205 | buildActionMask = 2147483647; 206 | files = ( 207 | BF8C562A1D3497F30003550C /* LaunchScreen.storyboard in Resources */, 208 | BF8C56271D3497F30003550C /* Assets.xcassets in Resources */, 209 | BF8C56251D3497F30003550C /* Main.storyboard in Resources */, 210 | ); 211 | runOnlyForDeploymentPostprocessing = 0; 212 | }; 213 | /* End PBXResourcesBuildPhase section */ 214 | 215 | /* Begin PBXSourcesBuildPhase section */ 216 | BF8C56131D3497F30003550C /* Sources */ = { 217 | isa = PBXSourcesBuildPhase; 218 | buildActionMask = 2147483647; 219 | files = ( 220 | BF8C56451D34981B0003550C /* LYFavoriteViewController.m in Sources */, 221 | BF8C56471D34981B0003550C /* LYHomeCellModel.m in Sources */, 222 | BF8C56431D34981B0003550C /* LYContactViewController.m in Sources */, 223 | BF8C56481D34981B0003550C /* LYHomeViewController.m in Sources */, 224 | BF8C56441D34981B0003550C /* LYFavoriteCell.m in Sources */, 225 | BF8C56541D35D8A70003550C /* LYSideslipCell.m in Sources */, 226 | BF8C561F1D3497F30003550C /* AppDelegate.m in Sources */, 227 | BF8C56461D34981B0003550C /* LYHomeCell.m in Sources */, 228 | BF8C561C1D3497F30003550C /* main.m in Sources */, 229 | BF8C56421D34981B0003550C /* LYContactCell.m in Sources */, 230 | ); 231 | runOnlyForDeploymentPostprocessing = 0; 232 | }; 233 | /* End PBXSourcesBuildPhase section */ 234 | 235 | /* Begin PBXVariantGroup section */ 236 | BF8C56231D3497F30003550C /* Main.storyboard */ = { 237 | isa = PBXVariantGroup; 238 | children = ( 239 | BF8C56241D3497F30003550C /* Base */, 240 | ); 241 | name = Main.storyboard; 242 | sourceTree = ""; 243 | }; 244 | BF8C56281D3497F30003550C /* LaunchScreen.storyboard */ = { 245 | isa = PBXVariantGroup; 246 | children = ( 247 | BF8C56291D3497F30003550C /* Base */, 248 | ); 249 | name = LaunchScreen.storyboard; 250 | sourceTree = ""; 251 | }; 252 | /* End PBXVariantGroup section */ 253 | 254 | /* Begin XCBuildConfiguration section */ 255 | BF8C562C1D3497F30003550C /* Debug */ = { 256 | isa = XCBuildConfiguration; 257 | buildSettings = { 258 | ALWAYS_SEARCH_USER_PATHS = NO; 259 | CLANG_ANALYZER_NONNULL = YES; 260 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 261 | CLANG_CXX_LIBRARY = "libc++"; 262 | CLANG_ENABLE_MODULES = YES; 263 | CLANG_ENABLE_OBJC_ARC = YES; 264 | CLANG_WARN_BOOL_CONVERSION = YES; 265 | CLANG_WARN_CONSTANT_CONVERSION = YES; 266 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 267 | CLANG_WARN_EMPTY_BODY = YES; 268 | CLANG_WARN_ENUM_CONVERSION = YES; 269 | CLANG_WARN_INFINITE_RECURSION = YES; 270 | CLANG_WARN_INT_CONVERSION = YES; 271 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 272 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 273 | CLANG_WARN_UNREACHABLE_CODE = YES; 274 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 275 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 276 | COPY_PHASE_STRIP = NO; 277 | DEBUG_INFORMATION_FORMAT = dwarf; 278 | ENABLE_STRICT_OBJC_MSGSEND = YES; 279 | ENABLE_TESTABILITY = YES; 280 | GCC_C_LANGUAGE_STANDARD = gnu99; 281 | GCC_DYNAMIC_NO_PIC = NO; 282 | GCC_NO_COMMON_BLOCKS = YES; 283 | GCC_OPTIMIZATION_LEVEL = 0; 284 | GCC_PREPROCESSOR_DEFINITIONS = ( 285 | "DEBUG=1", 286 | "$(inherited)", 287 | ); 288 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 289 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 290 | GCC_WARN_UNDECLARED_SELECTOR = YES; 291 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 292 | GCC_WARN_UNUSED_FUNCTION = YES; 293 | GCC_WARN_UNUSED_VARIABLE = YES; 294 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 295 | MTL_ENABLE_DEBUG_INFO = YES; 296 | ONLY_ACTIVE_ARCH = YES; 297 | SDKROOT = iphoneos; 298 | TARGETED_DEVICE_FAMILY = "1,2"; 299 | }; 300 | name = Debug; 301 | }; 302 | BF8C562D1D3497F30003550C /* Release */ = { 303 | isa = XCBuildConfiguration; 304 | buildSettings = { 305 | ALWAYS_SEARCH_USER_PATHS = NO; 306 | CLANG_ANALYZER_NONNULL = YES; 307 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 308 | CLANG_CXX_LIBRARY = "libc++"; 309 | CLANG_ENABLE_MODULES = YES; 310 | CLANG_ENABLE_OBJC_ARC = YES; 311 | CLANG_WARN_BOOL_CONVERSION = YES; 312 | CLANG_WARN_CONSTANT_CONVERSION = YES; 313 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 314 | CLANG_WARN_EMPTY_BODY = YES; 315 | CLANG_WARN_ENUM_CONVERSION = YES; 316 | CLANG_WARN_INFINITE_RECURSION = YES; 317 | CLANG_WARN_INT_CONVERSION = YES; 318 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 319 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 320 | CLANG_WARN_UNREACHABLE_CODE = YES; 321 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 322 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 323 | COPY_PHASE_STRIP = NO; 324 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 325 | ENABLE_NS_ASSERTIONS = NO; 326 | ENABLE_STRICT_OBJC_MSGSEND = YES; 327 | GCC_C_LANGUAGE_STANDARD = gnu99; 328 | GCC_NO_COMMON_BLOCKS = YES; 329 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 330 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 331 | GCC_WARN_UNDECLARED_SELECTOR = YES; 332 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 333 | GCC_WARN_UNUSED_FUNCTION = YES; 334 | GCC_WARN_UNUSED_VARIABLE = YES; 335 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 336 | MTL_ENABLE_DEBUG_INFO = NO; 337 | SDKROOT = iphoneos; 338 | TARGETED_DEVICE_FAMILY = "1,2"; 339 | VALIDATE_PRODUCT = YES; 340 | }; 341 | name = Release; 342 | }; 343 | BF8C562F1D3497F30003550C /* Debug */ = { 344 | isa = XCBuildConfiguration; 345 | buildSettings = { 346 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 347 | DEVELOPMENT_TEAM = ""; 348 | INFOPLIST_FILE = LYSideslipCellDemo/Info.plist; 349 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 350 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 351 | PRODUCT_BUNDLE_IDENTIFIER = com.louis.liuyi.LYSideslipCellDemo; 352 | PRODUCT_NAME = "$(TARGET_NAME)"; 353 | }; 354 | name = Debug; 355 | }; 356 | BF8C56301D3497F30003550C /* Release */ = { 357 | isa = XCBuildConfiguration; 358 | buildSettings = { 359 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 360 | DEVELOPMENT_TEAM = ""; 361 | INFOPLIST_FILE = LYSideslipCellDemo/Info.plist; 362 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 363 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 364 | PRODUCT_BUNDLE_IDENTIFIER = com.louis.liuyi.LYSideslipCellDemo; 365 | PRODUCT_NAME = "$(TARGET_NAME)"; 366 | }; 367 | name = Release; 368 | }; 369 | /* End XCBuildConfiguration section */ 370 | 371 | /* Begin XCConfigurationList section */ 372 | BF8C56121D3497F30003550C /* Build configuration list for PBXProject "LYSideslipCellDemo" */ = { 373 | isa = XCConfigurationList; 374 | buildConfigurations = ( 375 | BF8C562C1D3497F30003550C /* Debug */, 376 | BF8C562D1D3497F30003550C /* Release */, 377 | ); 378 | defaultConfigurationIsVisible = 0; 379 | defaultConfigurationName = Release; 380 | }; 381 | BF8C562E1D3497F30003550C /* Build configuration list for PBXNativeTarget "LYSideslipCellDemo" */ = { 382 | isa = XCConfigurationList; 383 | buildConfigurations = ( 384 | BF8C562F1D3497F30003550C /* Debug */, 385 | BF8C56301D3497F30003550C /* Release */, 386 | ); 387 | defaultConfigurationIsVisible = 0; 388 | defaultConfigurationName = Release; 389 | }; 390 | /* End XCConfigurationList section */ 391 | }; 392 | rootObject = BF8C560F1D3497F30003550C /* Project object */; 393 | } 394 | -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // LYSideslipCellDemo 4 | // 5 | // Created by Louis on 16/7/12. 6 | // Copyright © 2016年 Louis. 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 | -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // LYSideslipCellDemo 4 | // 5 | // Created by Louis on 16/7/12. 6 | // Copyright © 2016年 Louis. 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 | -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | } 88 | ], 89 | "info" : { 90 | "version" : 1, 91 | "author" : "xcode" 92 | } 93 | } -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/Fav_Edit_Delete.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "Fav_Edit_Delete.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/Fav_Edit_Delete.imageset/Fav_Edit_Delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/louis-ly/LYSideslipCell/bf5679e9459fcd02922ad673a7c80036d2fb6f1c/LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/Fav_Edit_Delete.imageset/Fav_Edit_Delete.png -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/Fav_Edit_Tag.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "Fav_Edit_Tag.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/Fav_Edit_Tag.imageset/Fav_Edit_Tag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/louis-ly/LYSideslipCell/bf5679e9459fcd02922ad673a7c80036d2fb6f1c/LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/Fav_Edit_Tag.imageset/Fav_Edit_Tag.png -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/ReadVerified_icon.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "ReadVerified_icon.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/ReadVerified_icon.imageset/ReadVerified_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/louis-ly/LYSideslipCell/bf5679e9459fcd02922ad673a7c80036d2fb6f1c/LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/ReadVerified_icon.imageset/ReadVerified_icon.png -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/TabBar/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/TabBar/tabbar_badge.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "tabbar_badge.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/TabBar/tabbar_badge.imageset/tabbar_badge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/louis-ly/LYSideslipCell/bf5679e9459fcd02922ad673a7c80036d2fb6f1c/LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/TabBar/tabbar_badge.imageset/tabbar_badge.png -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/TabBar/tabbar_contacts.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "tabbar_contacts.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/TabBar/tabbar_contacts.imageset/tabbar_contacts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/louis-ly/LYSideslipCell/bf5679e9459fcd02922ad673a7c80036d2fb6f1c/LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/TabBar/tabbar_contacts.imageset/tabbar_contacts.png -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/TabBar/tabbar_contactsHL.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "tabbar_contactsHL.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/TabBar/tabbar_contactsHL.imageset/tabbar_contactsHL.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/louis-ly/LYSideslipCell/bf5679e9459fcd02922ad673a7c80036d2fb6f1c/LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/TabBar/tabbar_contactsHL.imageset/tabbar_contactsHL.png -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/TabBar/tabbar_discover.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "tabbar_discover.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/TabBar/tabbar_discover.imageset/tabbar_discover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/louis-ly/LYSideslipCell/bf5679e9459fcd02922ad673a7c80036d2fb6f1c/LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/TabBar/tabbar_discover.imageset/tabbar_discover.png -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/TabBar/tabbar_discoverHL.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "tabbar_discoverHL.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/TabBar/tabbar_discoverHL.imageset/tabbar_discoverHL.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/louis-ly/LYSideslipCell/bf5679e9459fcd02922ad673a7c80036d2fb6f1c/LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/TabBar/tabbar_discoverHL.imageset/tabbar_discoverHL.png -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/TabBar/tabbar_mainframe.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "tabbar_mainframe.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/TabBar/tabbar_mainframe.imageset/tabbar_mainframe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/louis-ly/LYSideslipCell/bf5679e9459fcd02922ad673a7c80036d2fb6f1c/LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/TabBar/tabbar_mainframe.imageset/tabbar_mainframe.png -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/TabBar/tabbar_mainframeHL.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "tabbar_mainframeHL.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/TabBar/tabbar_mainframeHL.imageset/tabbar_mainframeHL.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/louis-ly/LYSideslipCell/bf5679e9459fcd02922ad673a7c80036d2fb6f1c/LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/TabBar/tabbar_mainframeHL.imageset/tabbar_mainframeHL.png -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/TabBar/tabbar_me.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "tabbar_me.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/TabBar/tabbar_me.imageset/tabbar_me.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/louis-ly/LYSideslipCell/bf5679e9459fcd02922ad673a7c80036d2fb6f1c/LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/TabBar/tabbar_me.imageset/tabbar_me.png -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/TabBar/tabbar_meHL.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "tabbar_meHL.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/TabBar/tabbar_meHL.imageset/tabbar_meHL.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/louis-ly/LYSideslipCell/bf5679e9459fcd02922ad673a7c80036d2fb6f1c/LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/TabBar/tabbar_meHL.imageset/tabbar_meHL.png -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/add_friend_icon_offical.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "add_friend_icon_offical.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/add_friend_icon_offical.imageset/add_friend_icon_offical.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/louis-ly/LYSideslipCell/bf5679e9459fcd02922ad673a7c80036d2fb6f1c/LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/add_friend_icon_offical.imageset/add_friend_icon_offical.png -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/icon0.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "icon0.jpeg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/icon0.imageset/icon0.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/louis-ly/LYSideslipCell/bf5679e9459fcd02922ad673a7c80036d2fb6f1c/LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/icon0.imageset/icon0.jpeg -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/icon1.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "icon1.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/icon1.imageset/icon1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/louis-ly/LYSideslipCell/bf5679e9459fcd02922ad673a7c80036d2fb6f1c/LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/icon1.imageset/icon1.jpg -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/icon2.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "icon2.jpeg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/icon2.imageset/icon2.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/louis-ly/LYSideslipCell/bf5679e9459fcd02922ad673a7c80036d2fb6f1c/LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/icon2.imageset/icon2.jpeg -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/icon3.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "icon3.jpeg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/icon3.imageset/icon3.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/louis-ly/LYSideslipCell/bf5679e9459fcd02922ad673a7c80036d2fb6f1c/LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/icon3.imageset/icon3.jpeg -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/icon4.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "icon4.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/icon4.imageset/icon4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/louis-ly/LYSideslipCell/bf5679e9459fcd02922ad673a7c80036d2fb6f1c/LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/icon4.imageset/icon4.jpg -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/login_logo.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "idiom" : "universal", 13 | "filename" : "login_logo.png", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/login_logo.imageset/login_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/louis-ly/LYSideslipCell/bf5679e9459fcd02922ad673a7c80036d2fb6f1c/LYSideslipCellDemo/LYSideslipCellDemo/Assets.xcassets/login_logo.imageset/login_logo.png -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/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 | -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/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 | 41 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Contact/LYContactCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // LYContactCell.h 3 | // LYSideslipCellDemo 4 | // 5 | // Created by Louis on 16/7/7. 6 | // Copyright © 2016年 Louis. All rights reserved. 7 | // 8 | 9 | #import "LYSideslipCell.h" 10 | 11 | @interface LYContactCell : LYSideslipCell 12 | @property (weak, nonatomic) IBOutlet UIImageView *iconImageView; 13 | @property (weak, nonatomic) IBOutlet UILabel *nameLabel; 14 | @end 15 | -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Contact/LYContactCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // LYContactCell.m 3 | // LYSideslipCellDemo 4 | // 5 | // Created by Louis on 16/7/7. 6 | // Copyright © 2016年 Louis. All rights reserved. 7 | // 8 | 9 | #import "LYContactCell.h" 10 | 11 | @interface LYContactCell () 12 | @end 13 | @implementation LYContactCell 14 | @end 15 | -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Contact/LYContactViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // LYContactViewController.h 3 | // LYSideslipCellDemo 4 | // 5 | // Created by Louis on 16/7/7. 6 | // Copyright © 2016年 Louis. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LYContactViewController : UITableViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Contact/LYContactViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // LYContactViewController.m 3 | // LYSideslipCellDemo 4 | // 5 | // Created by Louis on 16/7/7. 6 | // Copyright © 2016年 Louis. All rights reserved. 7 | // 8 | 9 | #import "LYContactViewController.h" 10 | #import "LYContactCell.h" 11 | 12 | @interface LYContactViewController () 13 | @property (nonatomic, strong) NSArray *titles; 14 | @end 15 | 16 | @implementation LYContactViewController 17 | 18 | - (void)viewDidLoad { 19 | [super viewDidLoad]; 20 | self.tableView.sectionIndexBackgroundColor = [UIColor clearColor]; 21 | self.tableView.sectionIndexColor = [UIColor colorWithRed:0 green:185/255.0 blue:1 alpha:1]; 22 | } 23 | 24 | #pragma mark - Table view data source 25 | 26 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 27 | return self.titles.count; 28 | } 29 | 30 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 31 | return 5; 32 | } 33 | 34 | 35 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 36 | LYContactCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([LYContactCell class]) forIndexPath:indexPath]; 37 | cell.delegate = self; 38 | 39 | cell.iconImageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"icon%ld", indexPath.row]]; 40 | 41 | cell.nameLabel.text = [NSString stringWithFormat:@"cellForRowAtIndexPath - %ld", indexPath.row]; 42 | 43 | return cell; 44 | } 45 | 46 | - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { 47 | cell.preservesSuperviewLayoutMargins = NO; 48 | if ([cell respondsToSelector:@selector(setSeparatorInset:)]) { 49 | [cell setSeparatorInset:UIEdgeInsetsMake(0, 10, 0, 0)]; 50 | } 51 | 52 | if ([cell respondsToSelector:@selector(setLayoutMargins:)]) { 53 | [cell setLayoutMargins:UIEdgeInsetsMake(0, 10, 0, 0)]; 54 | } 55 | } 56 | 57 | 58 | - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { 59 | return 22; 60 | } 61 | 62 | - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { 63 | UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 22)]; 64 | headerView.backgroundColor = [UIColor colorWithWhite:0.95 alpha:1]; 65 | 66 | UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(10, 0, headerView.frame.size.width - 10, 22)]; 67 | label.text = self.titles[section]; 68 | label.font = [UIFont systemFontOfSize:12.0f]; 69 | label.textColor = [UIColor grayColor]; 70 | [headerView addSubview:label]; 71 | return headerView; 72 | } 73 | 74 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 75 | [tableView deselectRowAtIndexPath:indexPath animated:YES]; 76 | } 77 | 78 | - (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView { 79 | return self.titles; 80 | } 81 | 82 | #pragma mark - LYSideslipCellDelegate 83 | - (NSArray *)sideslipCell:(LYSideslipCell *)sideslipCell editActionsForRowAtIndexPath:(NSIndexPath *)indexPath { 84 | LYSideslipCellAction *action = [LYSideslipCellAction rowActionWithStyle:LYSideslipCellActionStyleNormal title:@"备注" handler:^(LYSideslipCellAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) { 85 | [sideslipCell hiddenAllSideslip]; 86 | }]; 87 | return @[action]; 88 | } 89 | 90 | - (NSArray *)titles { 91 | if (!_titles) { 92 | _titles = @[@"A", @"B", @"C", @"E", @"F", @"G", @"H", @"I", @"J", @"K", @"L", @"M", @"N"]; 93 | } 94 | return _titles; 95 | } 96 | @end 97 | -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Favorite/LYFavoriteCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // LYFavoriteCell.h 3 | // LYSideslipCellDemo 4 | // 5 | // Created by Louis on 16/7/7. 6 | // Copyright © 2016年 Louis. All rights reserved. 7 | // 8 | 9 | #import "LYSideslipCell.h" 10 | 11 | @interface LYFavoriteCell : LYSideslipCell 12 | @property (weak, nonatomic) IBOutlet UIImageView *avatarImageView; 13 | @property (weak, nonatomic) IBOutlet UILabel *titleLabel; 14 | @property (weak, nonatomic) IBOutlet UIImageView *coverImageView; 15 | @property (weak, nonatomic) IBOutlet UILabel *contentLabel; 16 | @property (weak, nonatomic) IBOutlet UILabel *timeLabel; 17 | @end 18 | -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Favorite/LYFavoriteCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // LYFavoriteCell.m 3 | // LYSideslipCellDemo 4 | // 5 | // Created by Louis on 16/7/7. 6 | // Copyright © 2016年 Louis. All rights reserved. 7 | // 8 | 9 | #import "LYFavoriteCell.h" 10 | 11 | @interface LYFavoriteCell () 12 | 13 | 14 | @end 15 | @implementation LYFavoriteCell 16 | 17 | - (void)awakeFromNib { 18 | [super awakeFromNib]; 19 | _avatarImageView.layer.cornerRadius = _avatarImageView.frame.size.width / 2; 20 | } 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Favorite/LYFavoriteViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // LYFavoriteViewController.h 3 | // LYSideslipCellDemo 4 | // 5 | // Created by Louis on 16/7/7. 6 | // Copyright © 2016年 Louis. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LYFavoriteViewController : UITableViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Favorite/LYFavoriteViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // LYFavoriteViewController.m 3 | // LYSideslipCellDemo 4 | // 5 | // Created by Louis on 16/7/7. 6 | // Copyright © 2016年 Louis. All rights reserved. 7 | // 8 | 9 | #import "LYFavoriteViewController.h" 10 | #import "LYFavoriteCell.h" 11 | 12 | @interface LYFavoriteViewController () 13 | 14 | @end 15 | 16 | @implementation LYFavoriteViewController 17 | 18 | - (void)viewDidLoad { 19 | [super viewDidLoad]; 20 | 21 | self.tableView.backgroundColor = [UIColor colorWithWhite:0.95 alpha:1]; 22 | } 23 | 24 | 25 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 26 | return 20; 27 | } 28 | 29 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 30 | return 1; 31 | } 32 | 33 | 34 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 35 | LYFavoriteCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([LYFavoriteCell class]) forIndexPath:indexPath]; 36 | cell.delegate = self; 37 | cell.backgroundColor = [UIColor clearColor]; 38 | 39 | cell.avatarImageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"icon%d", arc4random()%5]]; 40 | 41 | cell.coverImageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"icon%d", arc4random()%5]]; 42 | 43 | cell.titleLabel.text = [NSString stringWithFormat:@"雷锋网 - %ld", indexPath.section]; 44 | 45 | cell.contentLabel.text = @"前微软中国用户体验顾问带你深入体验Holoens. 啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦"; 46 | 47 | return cell; 48 | } 49 | 50 | - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { 51 | return 8; 52 | } 53 | 54 | - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { 55 | UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.frame.size.width, 8)]; 56 | view.backgroundColor = [UIColor colorWithWhite:0.95 alpha:1]; 57 | return view; 58 | } 59 | 60 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 61 | [tableView deselectRowAtIndexPath:indexPath animated:YES]; 62 | } 63 | 64 | #pragma mark - LYSideslipCellDelegate 65 | - (NSArray *)sideslipCell:(LYSideslipCell *)sideslipCell editActionsForRowAtIndexPath:(NSIndexPath *)indexPath { 66 | LYSideslipCellAction *tagAction = [LYSideslipCellAction rowActionWithStyle:LYSideslipCellActionStyleNormal title:nil handler:^(LYSideslipCellAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) { 67 | NSLog(@"点击的打标签按钮"); 68 | [sideslipCell hiddenAllSideslip]; 69 | }]; 70 | tagAction.backgroundColor = [UIColor clearColor]; 71 | tagAction.image = [UIImage imageNamed:@"Fav_Edit_Tag"]; 72 | 73 | LYSideslipCellAction *deleteAction = [LYSideslipCellAction rowActionWithStyle:LYSideslipCellActionStyleNormal title:nil handler:^(LYSideslipCellAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) { 74 | NSLog(@"点击的删除按钮"); 75 | [sideslipCell hiddenAllSideslip]; 76 | }]; 77 | deleteAction.backgroundColor = [UIColor clearColor]; 78 | deleteAction.image = [UIImage imageNamed:@"Fav_Edit_Delete"]; 79 | return @[tagAction, deleteAction]; 80 | } 81 | @end 82 | -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Home/LYHomeCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // LYHomeCell.h 3 | // LYSideslipCellDemo 4 | // 5 | // Created by Louis on 16/7/5. 6 | // Copyright © 2016年 Louis. All rights reserved. 7 | // 8 | 9 | #import "LYSideslipCell.h" 10 | #import "LYHomeCellModel.h" 11 | 12 | @interface LYHomeCell : LYSideslipCell 13 | @property (nonatomic, strong) LYHomeCellModel *model; 14 | @end 15 | -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Home/LYHomeCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // LYHomeCell.m 3 | // LYSideslipCellDemo 4 | // 5 | // Created by Louis on 16/7/5. 6 | // Copyright © 2016年 Louis. All rights reserved. 7 | // 8 | 9 | #import "LYHomeCell.h" 10 | 11 | @interface LYHomeCell () 12 | @property (nonatomic, strong) UIImageView *iconImageView; 13 | @property (nonatomic, strong) UILabel *userNameLabel; 14 | @property (nonatomic, strong) UILabel *lastMessageLabel; 15 | @property (nonatomic, strong) UILabel *timeLabel; 16 | @end 17 | 18 | @implementation LYHomeCell 19 | 20 | - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { 21 | if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { 22 | _iconImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 50, 50)]; 23 | _iconImageView.contentMode = UIViewContentModeScaleAspectFill; 24 | _iconImageView.clipsToBounds = YES; 25 | _iconImageView.layer.cornerRadius = 6; 26 | _iconImageView.layer.borderColor = [UIColor colorWithWhite:0 alpha:0.2].CGColor; 27 | _iconImageView.layer.borderWidth = 0.5; 28 | [self.contentView addSubview:_iconImageView]; 29 | 30 | _userNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_iconImageView.frame) + 10, 10, 200, 25)]; 31 | [self.contentView addSubview:_userNameLabel]; 32 | 33 | _lastMessageLabel = [UILabel new]; 34 | _lastMessageLabel.textColor = [UIColor grayColor]; 35 | _lastMessageLabel.font = [UIFont systemFontOfSize:14]; 36 | [self.contentView addSubview:_lastMessageLabel]; 37 | 38 | _timeLabel = [UILabel new]; 39 | _timeLabel.font = [UIFont systemFontOfSize:12]; 40 | _timeLabel.textColor = [UIColor lightGrayColor]; 41 | _timeLabel.textAlignment = NSTextAlignmentRight; 42 | [self.contentView addSubview:_timeLabel]; 43 | } 44 | return self; 45 | } 46 | 47 | - (void)layoutSubviews { 48 | [super layoutSubviews]; 49 | CGFloat screenWidth = [UIScreen mainScreen].bounds.size.width; 50 | _lastMessageLabel.frame = CGRectMake(CGRectGetMinX(_userNameLabel.frame), CGRectGetMaxY(_userNameLabel.frame), screenWidth - CGRectGetMinX(_userNameLabel.frame) - 10, 25); 51 | _timeLabel.frame = CGRectMake(screenWidth - 200 - 10, 10, 200, 25); 52 | } 53 | 54 | - (void)setModel:(LYHomeCellModel *)model { 55 | _model = model; 56 | 57 | _iconImageView.image = [UIImage imageNamed:model.iconName]; 58 | 59 | _userNameLabel.text = model.userName; 60 | 61 | _lastMessageLabel.text = model.lastMessage; 62 | 63 | _timeLabel.text = model.timeString; 64 | } 65 | @end 66 | -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Home/LYHomeCellModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // LYHomeCellModel.h 3 | // LYSideslipCellDemo 4 | // 5 | // Created by Louis on 16/7/5. 6 | // Copyright © 2016年 Louis. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | typedef NS_ENUM(NSInteger, LYHomeCellType) { 13 | LYHomeCellTypeMessage, 14 | LYHomeCellTypePubliction, 15 | LYHomeCellTypeSubscription 16 | }; 17 | 18 | @interface LYHomeCellModel : NSObject 19 | @property (nonatomic, copy) NSString *iconName; 20 | @property (nonatomic, copy) NSString *userName; 21 | @property (nonatomic, copy) NSString *timeString; 22 | @property (nonatomic, copy) NSString *lastMessage; 23 | @property (nonatomic, assign) LYHomeCellType messageType; 24 | 25 | + (NSMutableArray *)requestDataArray; 26 | @end 27 | -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Home/LYHomeCellModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // LYHomeCellModel.m 3 | // LYSideslipCellDemo 4 | // 5 | // Created by Louis on 16/7/5. 6 | // Copyright © 2016年 Louis. All rights reserved. 7 | // 8 | 9 | #import "LYHomeCellModel.h" 10 | 11 | 12 | @implementation LYHomeCellModel 13 | + (NSMutableArray *)requestDataArray { 14 | NSArray *images = @[@"icon0", @"icon1", @"icon2", @"icon3", @"icon4"]; 15 | NSArray *names = @[@"Louis", @"老帅哥", @"iOS Coder", @"iOS Developer", @"Joe"]; 16 | NSArray *time = @[@"13:14", @"23:45", @"昨天", @"星期五", @"15/10/19"]; 17 | NSArray *lastMessage = @[@"你个傻×, 快回消息!", @"今天天气很好啊, 是不是?, 是不是?, 是不是?, 是不是?, 是不是?, 是不是?, 是不是?, 是不是?, 是不是?", @"http://www.louisly.com 我的博客哦", @"hello?", @"What can i do for you?"]; 18 | NSMutableArray *mArray = [NSMutableArray array]; 19 | for (int i = 0; i < 20; i++) { 20 | LYHomeCellModel *model = [LYHomeCellModel new]; 21 | model.iconName = images[arc4random()%5]; 22 | model.userName = names[arc4random()%5]; 23 | model.timeString = time[arc4random()%5]; 24 | model.lastMessage = lastMessage[arc4random()%5]; 25 | model.messageType = 0; 26 | if (i == 3) { 27 | model.messageType = 1; 28 | model.iconName = @"add_friend_icon_offical"; 29 | } 30 | if (i == 5) { 31 | model.messageType = 2; 32 | model.iconName = @"ReadVerified_icon"; 33 | } 34 | [mArray addObject:model]; 35 | } 36 | [mArray addObjectsFromArray:mArray]; 37 | return mArray; 38 | } 39 | @end 40 | -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Home/LYHomeViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // LYSideslipCellDemo 4 | // 5 | // Created by Louis on 16/7/5. 6 | // Copyright © 2016年 Louis. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LYHomeViewController : UITableViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/Home/LYHomeViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // LYSideslipCellDemo 4 | // 5 | // Created by Louis on 16/7/5. 6 | // Copyright © 2016年 Louis. All rights reserved. 7 | // 8 | 9 | #import "LYHomeViewController.h" 10 | #import "LYSideslipCell.h" 11 | #import "LYHomeCell.h" 12 | 13 | #define kIcon @"kIcon" 14 | #define kName @"kName" 15 | #define kTime @"kTime" 16 | #define kMessage @"kMessage" 17 | 18 | @interface LYHomeViewController () 19 | @property (nonatomic, strong) NSMutableArray *dataArray; 20 | @end 21 | 22 | @implementation LYHomeViewController { 23 | UIImageView *_logoImageView; 24 | } 25 | 26 | - (void)viewDidLoad { 27 | [super viewDidLoad]; 28 | self.tableView.backgroundColor = [UIColor colorWithRed:236/255.0 green:235/255.0 blue:243/255.0 alpha:1]; 29 | self.tableView.rowHeight = 70; 30 | _dataArray = [LYHomeCellModel requestDataArray]; 31 | 32 | _logoImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"login_logo"]]; 33 | _logoImageView.contentMode = UIViewContentModeCenter; 34 | _logoImageView.alpha = 0.7; 35 | [self.tableView addSubview:_logoImageView]; 36 | } 37 | 38 | - (void)viewWillLayoutSubviews { 39 | [super viewWillLayoutSubviews]; 40 | _logoImageView.frame = CGRectMake(0, -100, self.tableView.frame.size.width, 100); 41 | } 42 | 43 | #pragma mark - UITableViewDelegate 44 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 45 | return _dataArray.count; 46 | } 47 | 48 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 49 | LYHomeCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass(LYSideslipCell.class)]; 50 | if (!cell) { 51 | cell = [[LYHomeCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass(LYSideslipCell.class)]; 52 | cell.delegate = self; 53 | } 54 | cell.model = _dataArray[indexPath.row]; 55 | return cell; 56 | } 57 | 58 | - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { 59 | cell.preservesSuperviewLayoutMargins = NO; 60 | if ([cell respondsToSelector:@selector(setSeparatorInset:)]) { 61 | [cell setSeparatorInset:UIEdgeInsetsMake(0, 10, 0, 0)]; 62 | } 63 | 64 | if ([cell respondsToSelector:@selector(setLayoutMargins:)]) { 65 | [cell setLayoutMargins:UIEdgeInsetsMake(0, 10, 0, 0)]; 66 | } 67 | } 68 | 69 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 70 | [tableView deselectRowAtIndexPath:indexPath animated:YES]; 71 | } 72 | 73 | 74 | #pragma mark - LYSideslipCellDelegate 75 | - (NSArray *)sideslipCell:(LYSideslipCell *)sideslipCell editActionsForRowAtIndexPath:(NSIndexPath *)indexPath { 76 | LYHomeCellModel *model = _dataArray[indexPath.row]; 77 | LYSideslipCellAction *action1 = [LYSideslipCellAction rowActionWithStyle:LYSideslipCellActionStyleNormal title:@"取消关注" handler:^(LYSideslipCellAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) { 78 | NSLog(@"取消关注"); 79 | [sideslipCell hiddenAllSideslip]; 80 | }]; 81 | LYSideslipCellAction *action2 = [LYSideslipCellAction rowActionWithStyle:LYSideslipCellActionStyleDestructive title:@"删除" handler:^(LYSideslipCellAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) { 82 | NSLog(@"删除"); 83 | [_dataArray removeObjectAtIndex:indexPath.row]; 84 | [self.tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade]; 85 | }]; 86 | LYSideslipCellAction *action3 = [LYSideslipCellAction rowActionWithStyle:LYSideslipCellActionStyleNormal title:@"置顶" handler:^(LYSideslipCellAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) { 87 | NSLog(@"置顶"); 88 | [sideslipCell hiddenAllSideslip]; 89 | }]; 90 | 91 | NSArray *array = @[]; 92 | switch (model.messageType) { 93 | case LYHomeCellTypeMessage: 94 | array = @[action2]; 95 | break; 96 | case LYHomeCellTypeSubscription: 97 | array = @[action1, action2]; 98 | break; 99 | case LYHomeCellTypePubliction: 100 | array = @[action3, action2]; 101 | break; 102 | default: 103 | break; 104 | } 105 | return array; 106 | } 107 | 108 | - (BOOL)sideslipCell:(LYSideslipCell *)sideslipCell canSideslipRowAtIndexPath:(NSIndexPath *)indexPath { 109 | return YES; 110 | } 111 | 112 | 113 | @end 114 | -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/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.1.2 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 3 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 | -------------------------------------------------------------------------------- /LYSideslipCellDemo/LYSideslipCellDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // LYSideslipCellDemo 4 | // 5 | // Created by Louis on 16/7/12. 6 | // Copyright © 2016年 Louis. 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LYSideslipCell 2 | 3 | 高仿微信侧滑效果, 兼容代码和xib创建, 屏幕翻转. 4 | 5 | #### 首页消息Cell 6 | ![image](http://oad5jrdyg.bkt.clouddn.com/LYSideslipCell_Snapshot1.gif) 7 | 8 | 9 | #### 联系人Cell 10 | ![image](http://oad5jrdyg.bkt.clouddn.com/LYSideslipCell_Snapshot2.gif) 11 | 12 | #### 收藏Cell 13 | ![image](http://oad5jrdyg.bkt.clouddn.com/LYSideslipCell_Snapshot3.gif) 14 | 15 | 16 | ## Podfile 17 | 支持[CocoaPods](http://cocoapods.org/). 只要在`Podfile`文件中加入一行代码 18 | 19 | ``` 20 | pod 'LYSideslipCell' 21 | ``` 22 | 23 | 接着在终端输入`pod install`即可 24 | 25 | 26 | 27 | ## How to use 28 | 29 | 1.继承该类 30 | 31 | ``` 32 | @interface LYHomeCell : LYSideslipCell 33 | @end 34 | ``` 35 | 36 | 2.在`tableView:cellForRowAtIndexPath:`方法中设置代理: 37 | 38 | ``` 39 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 40 | LYHomeCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass(LYSideslipCell.class)]; 41 | if (!cell) { 42 | cell = [[LYHomeCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass(LYSideslipCell.class)]; 43 | cell.delegate = self; 44 | } 45 | return cell; 46 | } 47 | ``` 48 | 49 | 3.实现`LYSideslipCellDelegate`协议`sideslipCell:editActionsForRowAtIndexPath:`方法,返回侧滑按钮事件数组。 50 | 51 | ``` 52 | #pragma mark - LYSideslipCellDelegate 53 | - (NSArray *)sideslipCell:(LYSideslipCell *)sideslipCell editActionsForRowAtIndexPath:(NSIndexPath *)indexPath { 54 | LYSideslipCellAction *action = [LYSideslipCellAction rowActionWithStyle:LYSideslipCellActionStyleNormal title:@"备注" handler:^(LYSideslipCellAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) { 55 | [sideslipCell hiddenAllSideslip]; 56 | }]; 57 | return @[action]; 58 | } 59 | ``` 60 | 61 | 4.更多细节请看demo 62 | --------------------------------------------------------------------------------