2014-05-10 50 views
1

当用户滚动UITableView时,我尝试在iOS应用中制作一些特殊效果。我想实现的效果是:滚动时扭曲UITableViewCell?

enter image description here

这是从here

它由Capptivate制作,但我通过网站阅读&我仍然困惑我在哪里可以获得图书馆。

我知道核心图形/核心动画/ QuartzCore框架可能会有所帮助,正如暗示tutorial。因此,假设效果基于UITableView,那么我如何扭曲UITableViewCell像上面的屏幕截图一样?

我可以做弯曲表格单元格:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    static NSString * CellIdentifier = @"Cell"; 
    UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 

    if (![cell.backgroundView isKindOfClass:[CustomCellBackground class]]) { 
     CustomCellBackground * backgroundCell = [[CustomCellBackground alloc] init]; 
     cell.backgroundView = backgroundCell; 
    } 

    if (![cell.selectedBackgroundView isKindOfClass:[CustomCellBackground class]]) { 
     CustomCellBackground * selectedBackgroundCell = [[CustomCellBackground alloc] init]; 
     selectedBackgroundCell.selected = YES; 
     cell.selectedBackgroundView = selectedBackgroundCell; 
    } 

    NSString * entry; 

    if (indexPath.section == 0) { 
     entry = self.thingsToLearn[indexPath.row]; 
     ((CustomCellBackground *) cell.backgroundView).lastCell = indexPath.row == self.thingsToLearn.count - 1; 
     ((CustomCellBackground *)cell.selectedBackgroundView).lastCell = indexPath.row == self.thingsToLearn.count - 1; 
    } else { 
     entry = self.thingsLearned[indexPath.row]; 
     ((CustomCellBackground *)cell.backgroundView).lastCell = indexPath.row == self.thingsLearned.count - 1; 
     ((CustomCellBackground *)cell.selectedBackgroundView).lastCell = indexPath.row == self.thingsLearned.count - 1; 
    } 

    cell.textLabel.text = entry; 
    cell.textLabel.backgroundColor = [UIColor clearColor]; 
    cell.textLabel.highlightedTextColor = [UIColor blackColor]; 

    return cell; 
} 

,但我不知道如何使它响应滚动。

我的问题是:总之,滚动时我该如何制作曲线UITableViewCell


还有更多的做题我读:

和一些教程:

注:我工作的iOS 7+只。

+1

如果您在表中有固定数量的元素(如菜单)的工作,然后我会去的子视图,然后使用Quartz来创建一个路径Bezier曲线由touchesMoved方法控制,而不是使用UITableView和UITableViewCells。请记住,最终你在应用中看到的几乎是一个UIView或它的子类...... e – eharo2

+0

另外,检查这个例子,在touchesMoved中操作贝塞尔曲线,我发布了,这可能会帮助你。 http://stackoverflow.com/questions/22720179/uibezierpath-manipulation-on-ios/22720507#22720507 – eharo2

回答