Skip to content

Instantly share code, notes, and snippets.

View hafizrahman's full-sized avatar
🦉

Hafiz Rahman hafizrahman

🦉
View GitHub Profile
@hafizrahman
hafizrahman / gist:6835190
Created October 5, 2013 00:54
How to use tag in datasource methods.
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
NSInteger collectionID = collectionView.tag;
// do something about the id......
}
// The cell that is returned must be retrieved from a call to -dequeueReusableCellWithReuseIdentifier:forIndexPath:
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
NSInteger collectionID = collectionView.tag;
@hafizrahman
hafizrahman / gist:6835037
Last active December 24, 2015 17:19
Use setTag to as identifier for the UICollectionView objects, which can then be used by delegate and datasource methods.
for (int i = 0; i < 5; i++) {
UICollectionView *currentCollectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, maxWidth, collectionViewHeight) collectionViewLayout:layout];
// Trick to let the delegate and data source functions deal with the multiple UICollectionView's
[currentCollectionView setTag:i];
}
(function(e,t,n,r){function b(){var t=u;if(p==0&&c){if(!O())return}if(t.steps[p].popup.type!="modal"&&t.steps[p].popup.type!="nohighlight"){m.html("");if(t.steps[p].wrapper==""||t.steps[p].wrapper==r){alert('Your walkthrough position is: "'+t.steps[p].popup.type+'" but wrapper is empty or undefined. Please check your "'+a+'" wrapper parameter.');return}var i=B(e(t.steps[p].wrapper).offset().top);var s=B(e(t.steps[p].wrapper).offset().left);var o=B(e(t.steps[p].wrapper).innerWidth())||B(e(t.steps[p].wrapper).width());var f=B(e(t.steps[p].wrapper).innerHeight())||B(e(t.steps[p].wrapper).height());var l=F(t.steps[p].margin,"top"),h=F(t.steps[p].margin,"right"),d=F(t.steps[p].margin,"bottom"),v=F(t.steps[p].margin,"left"),g=30,y="",b="";var x={height:B(parseInt(i)-(parseInt(l)+g))};var T={top:x.height,width:B(parseInt(s)-(parseInt(v)+g)),height:B(parseInt(f)+g*2+parseInt(l)+parseInt(d))};if(t.steps[p].overlay==r||t.steps[p].overlay){y="overlay"}else{y="noOverlay";b="killOverlay"}var N=e('<div id="overlayTop" clas