NSScreencast Episode #107 Swipe to Reveal Cells
Swipe to Reveal Cells - NSScreencast
左スワイプして2種類のアクションを表示する
- Reveal $89 Reveal App
- cell - contentView - scrollView - view
- storyboard
- set same value of x, y(0, 0) and width, height to all views
- set autolayout 4 margins and width, height
- connect view outlet to cell (scroll view, inner view)
- delegate scroll view to cell
- storyboard
- MailMessageCell
- awakeFromNib
- 2 buttons on buttonContainerView
- [self.scrollView insertSubview:self.buttonContainerView belowSubview:self.innerContentView];
- repositionButtons
- layoutSubviews
- self.scrollView.contentSize =
- hide indicators
- self.scrollView.showsHorizontalScrollIndicator = NO;
- self.scrollView.showsVerticalScrollIndicator = NO;
- awakeFromNib
- UIScrollViewDelegate
- scrollViewDidScroll
- postNotificationName:RevealCellDidOpenNotification
- scrollViewWillEndDragging
- if (velocity.x > 0) {
- (*targetContentOffset).x = kRevealWidth;
- if (velocity.x > 0) {
- scrollViewDidScroll
- NSNotificationCenter
- 他のセルをスワイプするとそれ以外が閉じる
- @selector(onOpen:)
- name:RevealCellDidOpenNotification
- onOpen
- if (notification.object != self) {
- if (_isOpen) {
- animations:^{ self.scrollView.contentOffset = CGPointZero;