Comments (3)
I've added my own viewDidLoad
function which is called manually. This seems to work pretty well so far.
from genericdatasource.
Ok. Generally, I always do the same thing like you did. Just add it in viewDidLoad
. Because this is the correct place to do it in your situation, correct?. Now let's assume you have a UICollectionView
and you want to you have a nested hierarchy of data sources. You want to select an the first cell of an inner data source which happened be the 3rd element in the 2nd section. You have 2 ways:
- Just use
collectionView.selectItemAtIndexPath(NSIndexPath(forItem: 2, inSection: 1), animated: false, scrollPosition: .Top)
But this one needs to know beforehand where is your cell. And if the data source hierarchies is changed, you have to update the code.
- You can use the data sources.
// you might create your data source hierarchies first.
...
// Make sure to have first.
collectionView.ds_useDataSource(dataSource)
...
// then select the cell by using the data source this way.
innerDataSource.ds_reusableViewDelegate?.ds_selectItemAtIndexPath(NSIndexPath(forItem: 0, inSection: 0), animated: false, scrollPosition: .Top)
The advantage of second way is you don't need to know the global index path of your cell anymore.
from genericdatasource.
Please reopen if you more info.
from genericdatasource.
Related Issues (13)
- Title for section header HOT 4
- Support HeaderView/ FooterView for Sections HOT 2
- Tableview cell height HOT 1
- Spacing between cells HOT 4
- Inserting a new cell animation HOT 3
- How to add Item Selected event in the AppStore example HOT 1
- Images for README
- Future of project HOT 4
- How to achieve section insets HOT 1
- Screenshot HOT 1
- Remove unneeded ")" at the end of the description
- Update to swift 4 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from genericdatasource.