WLCardViewLayout: Card and swipe out layout of CollectView.(可以滑動刪除的卡片視圖布局)

jopen 8年前發布 | 11K 次閱讀 Objective-C開發 WLCardViewLayout

WLCardViewLayout

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

WLCardViewLayout is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "WLCardViewLayout"

支持cocoapods

pod "WLCardViewLayout"

效果

使用

在可視化編輯里:

然后關聯cardlayout至Controller:

@property (weak, nonatomic) IBOutlet WLCardViewLayout *cardLayout;
- (void)viewDidLoad {
[super viewDidLoad];
[self.cardLayout setSwipeToDeleteDelegate:self];
}

//CollectView數據源代理

  • (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{ return 1; }
  • (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{ return list.count; }
  • (UICollectionViewCell )collectionView:(UICollectionView )collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{

UICollectionViewCell cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"CardCell" forIndexPath:indexPath]; UIImageView im = [cell viewWithTag:100]; [im setImage:[UIImage imageNamed:list[indexPath.section]]]; return cell; }

//swipe刪除數據源代理

-(void)swipeToDeleteLayout:(WLCardViewLayout )layout didDeleteCellAtIndexPath:(NSIndexPath )indexPath{ [list removeObjectAtIndex:indexPath.section]; }</pre> </div>

Author

巫龍, 454763196@qq.com

License

WLCardViewLayout is available under the MIT license. See the LICENSE file for more info.


項目地址: https://github.com/HotWordland/WLCardViewLayout

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!