TabSwipable 0.0.3

TabSwipable 0.0.3

测试已测试
语言语言 Obj-CObjective C
许可 MIT
发布上次发布2016年4月

dby维护。



  • dby

Swipable


video
video


Swipable是什么

Swipable实现了类似于网易新闻的标签选择页,只需几行代码即可集成,具体使用方法请参考Demo。


Swipable的实现方法

Swipable是利用TableView来实现的,每个cell对应着一个ViewController的view(如下所示);然后利用旋转实现。

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
        UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:kHorizonalCellID forIndexPath:indexPath];
        cell.contentView.transform = CGAffineTransformMakeRotation(M_PI_2);
        cell.contentView.backgroundColor = [UIColor colorWithRed:235.0/255 green:235.0/255 blue:243.0/255 alpha:1.0];
        cell.selectionStyle = UITableViewCellSeparatorStyleNone;

        UIViewController *controller = _controllers[indexPath.row];
        controller.view.frame = cell.contentView.bounds;
        [cell.contentView addSubview:controller.view];

        return cell;
}

当没有旋转时:
video
TableView进行旋转90度:
video
TableView中的每个cell旋转90度:
video

至此,Swipable便实现了。


感谢

@开源中国:这个框架是在开源中国iOS客户端中总结出来的,并在此基础上进行了完善,欢迎大家再次进行完善。开源中国iOS客户端源代码地址:http://git.oschina.net/oschina/iphone-app