uicollectionview

Tap on UICollectionViewCell does not transition

女生的网名这么多〃 提交于 2019-12-25 00:29:49
问题 I do not use the storyboard. I write it with code only. I would like to know how to tap collectionviewcell to make a transition. Overlap of view of project is as follows. /*Color of each view VC (green) baseTableV (red) UItableViewCell ↓ HogeUIView (gray) tableV (blue) UItableViewCell ↓ orangeView(orange) baseColle (purple) Page0Cell (yellow) ↓ tableV (gray) UItableViewCell //I want to tap this cell to make a transition. But I can not. */ I will ask about that can not be transitioned by

What exactly is the IndexPath of a UICollection

孤者浪人 提交于 2019-12-24 22:48:34
问题 I'm having 2 problems with UICollectionViews, and I somehow believe it's related to the IndexPath in both cases, however I don't really know when is the Indexpath called or what exactly it does and when it gets updated or changed. Anyways, here are my issues: 1. Somehow the Indexpath is 0 multiple times?Youtube VIDEO showing behavior for this particular behavior here is the code: extension PointAllocVC: UICollectionViewDelegate, UICollectionViewDataSource { func collectionView(_

iOS仿网易新闻栏目拖动重排添加删除效果

▼魔方 西西 提交于 2019-12-24 21:44:43
仿网易新闻栏目选择页面的基本效果,今天抽了点时间教大家如何实现UICollectionView拖动的效果! 其实实现起来并不复杂,这里只是基本的功能,没有实现细节上的修改,连UI都是丑丑的样子,随手画的。 相信大家都使用过网易新闻客户端,里面的效果确定被不少人模仿,很多同类型的app都采用了人家的UI样式,那么今天就教大家如何去实现。 效果图 这是简略的效果图,样子是有点丑,将就看看吧: 实现原理 给UICollectionView添加一个手势或者其他方式,在长按时手动触发拖动开始,在移动过程中又要不断手动地更新位置,而在完成时手动触发完成操作,在取消时也要手动触发取消移动操作。 而要实现移动,必须设置是否可移动。比如我们的demo中第一个分区是要求移动的,而第二个分区是不允许移动的,因此我们需要通过代理来设置是否可移动。 在移动完成时,会有代理回调,此时我们要做的就是交换数据源来更新。 移动API介绍 首先我们必须要明确,这几个API是在iOS9之后才能使用的。这几个API来配合起来使用,才能最终达到我们期望的效果。 1 2 3 4 5 6 7 8 9 10 11 12 13 // 开始 - ( BOOL ) beginInteractiveMovementForItemAtIndexPath : ( NSIndexPath * ) indexPath NS_AVAILABLE

Setting toValue for CAShapeLayer animation from UICollectionView cellForItemAt indexPath

只谈情不闲聊 提交于 2019-12-24 20:23:15
问题 I have the following parts: - My main view is a UIViewController with a UICollectionView - The cell for the UICollectionView - A subclass of the UIView to build a CAShapeLayer with an CABasicAnimation In my main view I have a UICollectionView which renders a bunch of cells with labels etc. It also is showing a progress graph. In my subclass ProgressCirclePath() I am drawing a CAShapeLayer which is acting as the progress graph rendered in each cell of my UICollectionView. I have been able to

Passing XML Array Data to CollectionView via TableView

扶醉桌前 提交于 2019-12-24 20:02:34
问题 I'm attempting to pass an array of data from the view controller to the collection view cells. My collectionview is currently in a tableview. I have tried using delegation/protocols and creating arrays in the class and have not been able to successfully pass the data to my collectionview. My code is a follows: View Controller: var ageUnder10: [MissingPerson] = [] var age10Plus: [MissingPerson] = [] var age15Plus: [MissingPerson] = [] if let ageRange = ageRange { switch ageRange { case

Autosizing UICollectionView cell embedded in UITableView not working

痞子三分冷 提交于 2019-12-24 19:32:53
问题 I have spent a few day's now trying out things suggested on various SO posts but have not been able to figure this out. I'm probably looking right at the issue! I am making a switch over from Android to iOS and seem to be having some trouble with autolayout. Specifically, getting the UICollectionView to resize to the height of its content. Each collection view can have a different cell size based on its content but the cell size will be the same for each item on a given row. The

CollectionView inside TableViewCell

元气小坏坏 提交于 2019-12-24 18:55:40
问题 I used CollectionView inside TableViewCell . All works fine and shown all as expected. But if I scrolled the TableView very fast, items (i used images in collectionView) from one collection replaced with items (images) from another collection and override it on View (on Debug mode in code al works fine, its just displaying of them). UITableView GetCell(): public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { var item = _view.Items[indexPath.Row]; var cell =

Dismiss the view controller which have navigation controller and pass the value back to main view controller

混江龙づ霸主 提交于 2019-12-24 18:51:40
问题 I have an mainViewcontroller in that one button called get value.Then i am calling dataviewcontroller to select any item in collection view cell.Once user select any cell.That particular dataviewcontroller will dismiss and while dismiss it will have the user selected item name and it will display in mainViewcontroller .Now the view controller is not dismissing. Here the code : In my mainViewcontroller : var SelectedName: String? = "" override func viewWillAppear(_ animated: Bool) { super

Adding Constraint messed up view

大城市里の小女人 提交于 2019-12-24 18:41:17
问题 I have a view with a UICollectionView and a UISegmentedControl . I want to change constraints so the segment controller won't overlap collection view, like in this picture: This is my code : override func viewDidLoad() { super.viewDidLoad() self.navigationItem.leftBarButtonItem = nil self.tabBarController?.tabBar.isHidden = true self.SegmentController.setTitle(SegmentAtext, forSegmentAt: 0) self.SegmentController.setTitle(SegmentBtext, forSegmentAt: 1) self.view.bringSubview(toFront:

Change scrolling position of collection view, when view is currently not visible

时光总嘲笑我的痴心妄想 提交于 2019-12-24 16:42:32
问题 There are two scenarios where I have problem with setting the scrolling position of my collection view: on start up I want to scroll to a certain item (starting position != beginning of the collection view) view is currently not visible yet, but in "background" the collection view should scroll to a certain item What is a reliable way to scroll the collection view to a certain cell? Currently I'm setting the scrolling position with scrollToItemAtIndexPath in viewDidAppear , but that is too