Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (void)viewDidLoad
- {
- [super viewDidLoad];
- // Do any additional setup after loading the view, typically from a nib.
- UICollectionViewFlowLayout *layout=[[UICollectionViewFlowLayout alloc] init];
- _collectionView=[[UICollectionView alloc] initWithFrame:CGRectMake(130, 100, 780, 1024) collectionViewLayout:layout];
- _collectionView.autoresizesSubviews= YES;
- [_collectionView setDataSource:self];
- [_collectionView setDelegate:self];
- _collectionView.backgroundColor = [UIColor clearColor];
- [_collectionView registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:@"cellIdentifier"];
- [self.view addSubview:_collectionView];
- for (int i=0; i<12; i+=2) {
- NSIndexPath *index = [NSIndexPath indexPathForItem:i inSection:0];
- NSIndexPath *index1 = [NSIndexPath indexPathForItem:i+1 inSection:0];
- [_collectionView moveItemAtIndexPath:index toIndexPath:index1];
- }
- for (int i=2; i<12; i+=2) {
- NSIndexPath *index = [NSIndexPath indexPathForItem:i inSection:0];
- NSIndexPath *index1 = [NSIndexPath indexPathForItem:i+1 inSection:0];
- [_collectionView moveItemAtIndexPath:index toIndexPath:index1];
- }
- }
- - (void)didReceiveMemoryWarning
- {
- [super didReceiveMemoryWarning];
- // Dispose of any resources that can be recreated.
- }
- - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
- {
- return 12;
- }
- -(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
- {
- return 1;
- }
- - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
- {
- UICollectionViewCell *cell=[collectionView dequeueReusableCellWithReuseIdentifier:@"cellIdentifier" forIndexPath:indexPath];
- // code for customising the cell....
- cell.layer.shadowColor = [[UIColor blackColor]CGColor];
- cell.layer.shadowOffset = CGSizeMake(20, 20);
- cell.layer.borderColor = [[UIColor blackColor] CGColor];
- cell.layer.borderWidth =1;
- cell.alpha = 0;
- return cell;
- }
- -(CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section
- {
- return 10;
- }
- - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
- {
- return CGSizeMake(377, 172);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement