Commit d8c4cbdd authored by Felix Paul Kühne's avatar Felix Paul Kühne

iOS 7 phone library: let the user expand the collapsed media items with a long touch

parent 97c47963
......@@ -48,6 +48,11 @@
_tableView.delegate = self;
_tableView.dataSource = self;
self.view = _tableView;
if (SYSTEM_RUNS_IN_THE_FUTURE) {
UILongPressGestureRecognizer *gestureRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(tableViewLongTouchGestureAction:)];
[self.view addGestureRecognizer:gestureRecognizer];
}
} else {
UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
......@@ -333,6 +338,30 @@
[self openMediaObject:selectedObject];
}
#pragma mark - table view gestures
- (void)tableViewLongTouchGestureAction:(UIGestureRecognizer *)recognizer
{
NSIndexPath *path = [(UITableView *)self.view indexPathForRowAtPoint:[recognizer locationInView:self.view]];
UITableViewCell *cell = [(UITableView *)self.view cellForRowAtIndexPath:path];
CGRect frame = cell.frame;
if (frame.size.height > 90.)
frame.size.height = 90.;
else
frame.size.height = 180;
void (^animationBlock)() = ^() {
cell.frame = frame;
};
void (^completionBlock)(BOOL finished) = ^(BOOL finished) {
cell.frame = frame;
};
NSTimeInterval animationDuration = .2;
[UIView animateWithDuration:animationDuration animations:animationBlock completion:completionBlock];
}
#pragma mark - Collection View
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment