天道酬勤,学无止境

peek-pop

在同一个视图控制器中的多个集合视图或表格视图上实现 3D 触摸(Implement 3D touch on multiple collection views or table views in the same view controller)

问题 我想对我的应用程序的两个集合视图进行 3D 触摸(仅“Peek”功能)。 它们都包含在同一个视图控制器中。 无论我尝试什么语法,它总是在第一个集合视图中显示单元格的图像和文本,即使我在第二个集合视图中选择一个单元格。 如何将这些分开,以便只有一个专门针对我选择的 collectionview 单元格发生? 以下是我如何实现 3D 触摸功能: 我把它放在 VC 的 viewDidAppear 中,因为它由于某种原因在 viewDidLoad 中不起作用: override func viewDidAppear(animated: Bool) { if( traitCollection.forceTouchCapability == .Available){ registerForPreviewingWithDelegate(self, sourceView: collectionView1) registerForPreviewingWithDelegate(self, sourceView: collectionView2) } 这是我在包含两个集合视图的 VC 中的内容: func previewingContext(previewingContext: UIViewControllerPreviewing, viewControllerForLocation

2021-10-15 00:36:36    分类:技术分享    ios   swift   uicollectionview   3dtouch   peek-pop

Implement 3D touch on multiple collection views or table views in the same view controller

I would like to have 3D touch on both of the collection views of my app(Only the "Peek" functionality). They are both contained in the same view controller. No matter what syntax I try it always shows the image and text for the a cell in the first collectionview, even if I choose a cell in the second collection view. How do I separate these so that only one happens specifically for the collectionview cell I have selected? Here is how I am implementing the 3D touch functionality: I put this in VC's viewDidAppear because it wasn't working in viewDidLoad for some reason: override func

2021-10-12 07:05:14    分类:问答    ios   swift   uicollectionview   3dtouch   peek-pop

UITableView 单元格上的 Peek 和 Pop 因 UISearchController 失败(Peek and Pop on UITableView cells fails with UISearchController)

问题 Peek 和 Pop 正在使用UISearchController 。 但是,一旦您开始使用updateSearchResults搜索表,Peek 和 Pop 就会停止工作。 我已经使用 UISearchController 演示扩展了 Apple 的 Table Search 以支持 Peek 和 Pop 作为示例: 问题是当我开始搜索表格时,Peek 和 Pop 不再起作用。 它只是选择突出显示它: 我对MainTableViewController所做的更新是: class MainTableViewController: BaseTableViewController, UISearchBarDelegate, UISearchControllerDelegate, UISearchResultsUpdating { override func viewDidLoad() { super.viewDidLoad() ... if traitCollection.forceTouchCapability == .available { registerForPreviewing(with: self, sourceView: tableView) } } } extension MainTableViewController

2021-10-09 12:29:32    分类:技术分享    ios   swift   uitableview   uisearchcontroller   peek-pop

带顶栏的 3D Touch Peek(3D Touch Peek with Top Bar)

问题 我有一个UICollectionView ,它在3D Touch ed 时显示“Peek”。 作为默认行为,“Peek”忽略导航栏。 但是,我确实想像在iMessage Peek中一样显示一个栏,如下所示: Collection View Controller 和 Peek View Controller 都在 Navigation View Controller 中。 我在下面的 Apple 示例代码中有以下片段,我正在尝试将其修改为上述需求: extension ChatTableViewController: UIViewControllerPreviewingDelegate { func previewingContext(_ previewingContext: UIViewControllerPreviewing, viewControllerForLocation location: CGPoint) -> UIViewController? { guard let indexPath = tableView.indexPathForRow(at: location) else { return nil } let storyboard = UIStoryboard(name: "Main", bundle: nil) let viewController =

2021-10-09 06:46:37    分类:技术分享    ios   swift   uiviewcontroller   3dtouch   peek-pop

Peek/Pop 预览忽略集合视图中的单元格角半径(Peek/Pop preview ignores cell corner radius in collection view)

问题 我已将 3D Touch Peek/Pop 功能添加到我的集合视图单元格中,并且效果很好,但是我注意到预览框架不考虑单元格的角半径。 这是我的预览功能: func previewingContext(previewingContext: UIViewControllerPreviewing, viewControllerForLocation location: CGPoint) -> UIViewController? { let viewController = storyboard?.instantiateViewControllerWithIdentifier("scholarDetailViewController") as? ScholarDetailViewController let cellPosition = self.scholarsCollectionView.convertPoint(location, fromView: self.view) let cellIndex = self.scholarsCollectionView.indexPathForItemAtPoint(cellPosition) guard let previewViewController = viewController, indexPath = cellIndex

2021-10-07 11:00:31    分类:技术分享    ios   swift   uicollectionview   3dtouch   peek-pop

应用程序在 iPhone 6s 中的“peek and pop”实现中冻结(App is freezing in 'peek and pop' implementation in iPhone 6s)

问题 我已经在我的应用程序中实现了 peek 和 pop,它运行良好。 但是在连续尝试 7-8 次后,该应用程序冻结在窥视视图中。 我唯一的选择是杀死应用程序并重新运行。 请告诉我冻结的原因。 我在我的项目中使用了以下代码进行 peek 和 pop: var isPresentedBy3Dtouch: Bool = false var passedDetails:DetailModel! func previewingContext(previewingContext: UIViewControllerPreviewing, viewControllerForLocation location: CGPoint) -> UIViewController? { guard let indexPath = tableView?.indexPathForRowAtPoint(location) else { return nil } guard let cell = tableView?.cellForRowAtIndexPath(indexPath) else { return nil } guard let detailViewController = self.storyboard?.instantiateViewControllerWithIdentifier(

2021-09-30 16:29:25    分类:技术分享    ios   iphone   swift   peek-pop

3D Touch Peek with Top Bar

I have a UICollectionView that shows 'Peek' when 3D Touch'ed. As default behavior, 'Peek' ignores navigation bars. However, I do want to show a bar just as in iMessage Peek shown below: Both Collection View Controller & Peek View Controller are inside Navigation View Controller. I have following snippet from Apple's Sample code below that I am trying to modify in to above needs: extension ChatTableViewController: UIViewControllerPreviewingDelegate { func previewingContext(_ previewingContext: UIViewControllerPreviewing, viewControllerForLocation location: CGPoint) -> UIViewController? { guard

2021-06-28 06:48:12    分类:问答    ios   swift   uiviewcontroller   3dtouch   peek-pop

App is freezing in 'peek and pop' implementation in iPhone 6s

I have implemented peek and pop in my app and it works perfectly. But on continuously trying it for 7-8 times, the app freezes on peek view. The only option I have is to kill the app and re-run. Please let me know the reason for the freeze. I have used the following code for peek and pop in my project: var isPresentedBy3Dtouch: Bool = false var passedDetails:DetailModel! func previewingContext(previewingContext: UIViewControllerPreviewing, viewControllerForLocation location: CGPoint) -> UIViewController? { guard let indexPath = tableView?.indexPathForRowAtPoint(location) else { return nil }

2021-06-14 16:11:12    分类:问答    ios   iphone   swift   peek-pop

Peek/Pop preview ignores cell corner radius in collection view

I have added 3D Touch Peek/Pop functionality to my collection view cells and it works great, however I've noticed that the preview frame does not respect the corner radius of the cells. Here's my previewing function: func previewingContext(previewingContext: UIViewControllerPreviewing, viewControllerForLocation location: CGPoint) -> UIViewController? { let viewController = storyboard?.instantiateViewControllerWithIdentifier("scholarDetailViewController") as? ScholarDetailViewController let cellPosition = self.scholarsCollectionView.convertPoint(location, fromView: self.view) let cellIndex =

2021-06-11 05:52:59    分类:问答    ios   swift   uicollectionview   3dtouch   peek-pop

Peek and Pop on UITableView cells fails with UISearchController

Peek and Pop is working with a UISearchController. However, Peek and Pop stops working once you start searching the table using updateSearchResults. I've extended Apple's Table Search with UISearchController demo to support Peek and Pop as an example: Problem is when I start searching the table, Peek and Pop doesn't work anymore. It just select highlights it: The updates I made were to MainTableViewController are: class MainTableViewController: BaseTableViewController, UISearchBarDelegate, UISearchControllerDelegate, UISearchResultsUpdating { override func viewDidLoad() { super.viewDidLoad()

2021-06-04 11:17:32    分类:问答    ios   swift   uitableview   uisearchcontroller   peek-pop