collectionview

Swipe to delete on CollectionView

∥☆過路亽.° 提交于 2019-11-30 21:36:08
问题 I'm trying to replicate the swipe to delete function like in the mail tableview. Only this time I need to build it on a collectionview but I'm having a bit of a hard time. It's a horizontal scrolling list with a swipe up to delete. I already got the swipe up working but having a hard time figuring out how I need to setup the swipe to delete / tap to delete or ignore functionality. It looks like the following: So I'm using the following collectionview: func buildCollectionView() { let layout:

CollectionView duplicate cell when loading more data

白昼怎懂夜的黑 提交于 2019-11-30 08:10:24
问题 The problem: I have a CollectionView which loads a UIimage into each cell. However my problem is that when I load additional cells with more images they appear to duplicate. I can't quite see what could be causing this in my code. Might it be because of some problem with reusable cells? Can anyone see why this occurs? NOTE: The array with the images doesn't have duplicates Video of problem: https://www.youtube.com/watch?v=vjRsFc8DDmI Image of the problem: Here are my functions for

Is force cast really bad and should always avoid it?

◇◆丶佛笑我妖孽 提交于 2019-11-28 18:13:38
I started to use swiftLint and noticed one of the best practices for Swift is to avoid force cast. However I used it a lot when handling tableView, collectionView for cells : let cell = collectionView.dequeueReusableCellWithReuseIdentifier(cellID, forIndexPath: indexPath) as! MyOffersViewCell If this is not the best practice, what's the right way to handle this? I guess I can use if let with as?, but does that mean for else condition I will need to return an empty cell? Is that acceptable? if let cell = collectionView.dequeueReusableCellWithReuseIdentifier(cellID, forIndexPath: indexPath) as?

How do you set the duration for UICollectionView Animations?

可紊 提交于 2019-11-28 16:12:34
I have a custom flow layout which is adjusting the attributes for cells when they are being inserted and deleted from the CollectionView with the following two functions, but I'm unable to figure out how you would adjust the default animation duration. - (UICollectionViewLayoutAttributes *)initialLayoutAttributesForAppearingItemAtIndexPath:(NSIndexPath *)itemIndexPath { UICollectionViewLayoutAttributes* attributes = [self layoutAttributesForItemAtIndexPath:itemIndexPath]; // Assign the new layout attributes attributes.transform3D = CATransform3DMakeScale(0.5, 0.5, 0.5); attributes.alpha = 0;

Swift viewWillTransition not called

倖福魔咒の 提交于 2019-11-28 14:00:46
I'm creating a full screen image gallery using a UICollectionView . When the user rotates the device, I perform updates to the UICollectionView within func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) I present this UIViewController modally and have a UICollectionView taking up the full screen. Within viewDidLoad , I create the flow layout as: let flowLayout = UICollectionViewFlowLayout() flowLayout.scrollDirection = .horizontal flowLayout.minimumInteritemSpacing = 0 flowLayout.minimumLineSpacing = 0 photosCollectionView.isPagingEnabled = true

Using CollectionView in UIView with xib file

两盒软妹~` 提交于 2019-11-28 06:58:10
i'm doing with this, i want to use CollectionView, but i haven't seen prototype cell, and don't know how to use CollectionView in this case, can someone help me ? I try to use like this way but it take alot of time and hard to manage than UICollectionView The main way to use UICollectionView is by managing the logic programmatically. First, create a new class which inherits from UICollectionViewCell . Choose if you want to include a xib to easily design your cell: Design your cell with Interface Builder or programmatically. Create your main view controller including a xib (or a storyboard)

Multiple collectionView in a UIViewController - IOS swift

Deadly 提交于 2019-11-28 02:57:18
I tried many days to realise this: I want to add in my UIViewController two different CollectionView. For example I want to put images in these collectionView Each CollectionView use its own images. Is this possible? I will be very happy if somebody can give me a hand. :) This is possible, you just need to add each UICollectionView as a subview, and set the delegate and dataSource to your UIViewController. Here's a quick example. Assuming you have one UICollectionView working, you should be able to adapt this code to your own uses to add a second fairly easily: let collectionViewA =

Enforce collectionView to have only 2 rows

偶尔善良 提交于 2019-11-28 01:31:16
I have to make one collection view so that irrespective of iphone size we have just 2 images in each row and also we need border between each row and column as shown in the image. I want like this: Joe Try this code. Just a different approach. func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: IndexPath) -> CGSize { let layout = collectionView.collectionViewLayout as! UICollectionViewFlowLayout layout.sectionInset = UIEdgeInsets(top: 6, left: 4, bottom: 6, right: 4) layout.minimumInteritemSpacing = 04

NSFetchedResultsContollerDelegate for CollectionView

醉酒当歌 提交于 2019-11-27 17:18:42
I'd like to use the NSFetchedResultsControllerRelegate in a CollectionViewController. Therefore I just changed the method for the TableViewController for the CollectionView. (void)controller:(NSFetchedResultsController *)controller didChangeSection:(id <NSFetchedResultsSectionInfo>)sectionInfo atIndex:(NSUInteger)sectionIndex forChangeType:(NSFetchedResultsChangeType)type { switch(type) { case NSFetchedResultsChangeInsert: [self.collectionView insertSections:[NSIndexSet indexSetWithIndex:sectionIndex]]; break; case NSFetchedResultsChangeDelete: [self.collectionView deleteSections:[NSIndexSet

用WijmoJS玩转您的Web应用 —— Ionic

百般思念 提交于 2019-11-27 16:53:55
前言: 在本文中,我们将着重介绍如何将WijmoJS与Ionic一起使用,来创建一款移动端支持优先、快捷高效的应用程序。在之前的文章中,我们已经介绍了使用 WijmoJS 与 Angular 、 React 、 Vue 三大框架结合搭建您的Web应用程序。这篇将是本系列的最后一篇文章。 什么是Ionic? Ionic是一个专注于用Web开发技术,基于HTML5创建类似于手机平台原生应用的一个开发框架,它绑定了AngularJS和Sass。这个框架的目的是从web的角度开发手机应用,基于PhoneGap的编译平台,可以实现编译成各个平台的应用程序。 使用Ionic不但可以优化html、css和js的性能,构建高效的应用程序,而且还可以用于构建Sass和AngularJS的优化。对于用以开发混合手机应用的项目来说,ionic是一个值得信赖的框架。 WijmoJS VS Ionic Ionic 专注于应用程序的外观和用户界面交互。它基于Angular,并使用Cordova提供对特定设备本地功能的访问,包括传感器,数据,网络状态等。 作为同样流行的前端框架之一, WijmoJS 也同样注重更灵活、更智能的用户操作体验。秉承“快如闪电,触控优先”的设计理念,WijmoJS在提供优质服务和产品的同时,不断优化产品架构,与时俱进。凭借其先进的触控设计、全面的 AngularJS 支持、灵活的