Skip to content

Commit 1cc0824

Browse files
laydown
1 parent 15ea30c commit 1cc0824

File tree

4 files changed

+37
-12
lines changed

4 files changed

+37
-12
lines changed

TableViewAnimationKit-OC/TableViewAnimationKit-OC/BaseTableViewController.m

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
5858
view.backgroundColor = [UIColor orangeColor];
5959
view.layer.masksToBounds = YES;
6060
view.layer.cornerRadius = 9.0;
61-
view.alpha = 0.5;
62-
6361
[cell.contentView addSubview:view];
6462
cell.contentView.backgroundColor = [UIColor clearColor];
6563
cell.backgroundColor = [UIColor clearColor];
@@ -71,7 +69,6 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
7169

7270
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
7371
[tableView deselectRowAtIndexPath:indexPath animated:YES];
74-
[self starAnimationWithTableView:self.tableView];
7572
}
7673
#pragma mark - Getter
7774
-(UITableView *)tableView {
@@ -106,12 +103,13 @@ - (void)starAnimationWithTableView:(UITableView *)tableView {
106103
[TableViewAnimationKit toTopAnimationWithTableView:tableView];
107104
break;
108105
case 6:
109-
[TableViewAnimationKit moveAnimationWithTableView:tableView];
106+
[TableViewAnimationKit layDonwAnimationWithTableView:tableView];
110107
break;
111108
case 7:
112109
[TableViewAnimationKit shrinkToTopAnimationWithTableView:tableView];
113110
break;
114-
111+
case 8:
112+
break;
115113
default:
116114
break;
117115
}

TableViewAnimationKit-OC/TableViewAnimationKit-OC/TableViewAnimationKit.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@
1919
+ (void)toTopAnimationWithTableView:(UITableView *)tableView;
2020
+ (void)springListAnimationWithTableView:(UITableView *)tableView;
2121
+ (void)shrinkToTopAnimationWithTableView:(UITableView *)tableView;
22+
+ (void)layDonwAnimationWithTableView:(UITableView *)tableView;
2223

2324
@end

TableViewAnimationKit-OC/TableViewAnimationKit-OC/TableViewAnimationKit.m

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,35 @@ + (void)shrinkToTopAnimationWithTableView:(UITableView *)tableView {
153153
}
154154
}
155155

156+
+ (void)layDonwAnimationWithTableView:(UITableView *)tableView {
157+
NSArray *cells = tableView.visibleCells;
158+
NSMutableArray *rectArr = [[NSMutableArray alloc] init];
159+
for (int i = 0; i < cells.count; i++) {
160+
UITableViewCell *cell = [cells objectAtIndex:i];
161+
CGRect rect = cell.frame;
162+
[rectArr addObject:[NSValue valueWithCGRect:rect]];
163+
rect.origin.y = i * 10;
164+
cell.frame = rect;
165+
cell.layer.transform = CATransform3DMakeTranslation(0, 0, i*5);
166+
}
167+
168+
for (int i = 0; i < cells.count; i++) {
169+
UITableViewCell *cell = [cells objectAtIndex:i];
170+
CGRect rect = [[rectArr objectAtIndex:i] CGRectValue];
171+
[UIView animateWithDuration:0.2 * i animations:^{
172+
cell.frame = rect;
173+
} completion:^(BOOL finished) {
174+
cell.layer.transform = CATransform3DIdentity;
175+
}];
176+
}
177+
178+
}
156179

157180

158181
+ (void)flipCellAnimationWithTableView:(UITableView *)tableView {
159182

160-
// NSArray *cells = tableView.visibleCells;
183+
// NSArray *cells = tableView.visibleCells;
184+
161185
// for (int i = 0; i < cells.count; i++) {
162186
// UITableViewCell *cell = [cells objectAtIndex:i];
163187
// CGRect rect = [cell convertRect:cell.bounds fromView:tableView];
@@ -172,6 +196,7 @@ + (void)flipCellAnimationWithTableView:(UITableView *)tableView {
172196
+ (void)centerPointShowAnimationWithTableView:(UITableView *)tableView {
173197

174198

199+
175200
}
176201

177202
@end

TableViewAnimationKit-OC/TableViewAnimationKit-OC/ViewController.m

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@ - (void)viewDidLoad {
2828
//
2929
// btn.backgroundColor = [UIColor redColor];
3030
// [btn addTarget:self action:@selector(toTableViewVC) forControlEvents:UIControlEventTouchUpInside];
31-
//
32-
_titles = @[@"move",@"",@""];
33-
[self.view addSubview:self.tableView];
34-
31+
//
3532
// XSGravityCollisionView *baseView = [[XSGravityCollisionView alloc] init];
3633
// baseView.itemViews = @[btn];
3734
// baseView.frame = self.view.bounds;
3835
// [baseView starAnimation];
3936
// [self.view addSubview:baseView];
40-
//
37+
38+
_titles = @[@"1",@"2",@"3",@"4",@"5",@"6",@"lay",@""];
39+
[self.view addSubview:self.tableView];
40+
4141
}
4242
#pragma mark - Delegate
4343
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
@@ -61,7 +61,8 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
6161
}
6262
- (void)viewDidAppear:(BOOL)animated {
6363
[super viewDidAppear:animated];
64-
64+
65+
6566
}
6667

6768
- (UITableView *)tableView {

0 commit comments

Comments
 (0)