GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Coder-ZJQ/JQCollectionViewAlignLayout: A custom layout object based on flow layout. Added supports for horizontal, vertical alignment and RTL direction of collection view items.(available for both UICollectionView and NSCollectionView)

BranchesTags
Open more actions menu

Latest commit

 

History

26 Commits
26 Commits

Folders and files

NameName
Last commit message
Last commit date
.swiftpm/xcode/package.xcworkspace
.swiftpm/xcode/package.xcworkspace
 
 
Examples
Examples
 
 
JQCollectionViewAlignLayout
JQCollectionViewAlignLayout
 
 
images
images
 
 
.gitignore
.gitignore
 
 
JQCollectionViewAlignLayout.podspec
JQCollectionViewAlignLayout.podspec
 
 
LICENSE
LICENSE
 
 
Package.swift
Package.swift
 
 
README-ZH.md
README-ZH.md
 
 
README.md
README.md
 
 
_Pods.xcodeproj
_Pods.xcodeproj
 
 

Repository files navigation

English | 中文说明

JQCollectionViewAlignLayout

Version License Platform

A custom layout object based on flow layout, that supports setting horizontal, vertical alignment and RTL(right to left) direction of collection view items.

(available for both UICollectionView and NSCollectionView)

Example

To run the example project, clone the repo, and run pod install from the Examples directory first. Then open JQCollectionViewAlignLayout.xcworkspace with Xcode and choose a scheme below:

iOS

macOS

tvOS

Alignments and Directions

Horizontal Demo Image
JQCollectionViewItemsHorizontalAlignmentFlow(default)
JQCollectionViewItemsHorizontalAlignmentLeft
JQCollectionViewItemsHorizontalAlignmentCenter
JQCollectionViewItemsHorizontalAlignmentRight
JQCollectionViewItemsHorizontalAlignmentFlowFilled
Vertical Demo Image
JQCollectionViewItemsVerticalAlignmentCenter(default)
JQCollectionViewItemsVerticalAlignmentTop
JQCollectionViewItemsVerticalAlignmentBottom
Direction Demo Image
JQCollectionViewItemsDirectionLTR(default)
JQCollectionViewItemsDirectionRTL

Requirements

iOS 6.0 +

macOS 10.11 +

tvOS 9.0 +

Installation

JQCollectionViewAlignLayout is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'JQCollectionViewAlignLayout'

Usage

  1. Init the collectionView with JQCollectionViewAlignLayout:
  • by code:
// UICollectionView
JQCollectionViewAlignLayout *layout = [[JQCollectionViewAlignLayout alloc] init];
UICollectionView *collectionView = [[UICollectionView alloc] initWithFrame:self.view.bounds collectionViewLayout:layout];

// NSCollectionView
JQCollectionViewAlignLayout *layout = [[JQCollectionViewAlignLayout alloc] init];
NSCollectionView *collectionView = ...;
collectionView.layout = layout;
  • or setup in the Interface Builder:

  1. Setup the alignment and direction:
  • Property(for all sections):
layout.itemsHorizontalAlignment = JQCollectionViewItemsHorizontalAlignmentLeft;
layout.itemsVerticalAlignment = JQCollectionViewItemsVerticalAlignmentCenter;
layout.itemsDirection = JQCollectionViewItemsDirectionLTR;
  • Protocol(for each section):
// 1. conforms to protocol JQCollectionViewAlignLayoutDelegate
@interface JQViewController () < UICollectionViewDataSource, JQCollectionViewAlignLayoutDelegate>

@end

@implementation JQViewController
// 2. implement the protocol method
- (JQCollectionViewItemsHorizontalAlignment)collectionView:(UICollectionView *)collectionView layout:(JQCollectionViewAlignLayout *)layout itemsHorizontalAlignmentInSection:(NSInteger)section {
  // return the JQCollectionViewItemsHorizontalAlignment in section.
}

- (JQCollectionViewItemsVerticalAlignment)collectionView:(UICollectionView *)collectionView layout:(JQCollectionViewAlignLayout *)layout itemsVerticalAlignmentInSection:(NSInteger)section {
  // return the JQCollectionViewItemsVerticalAlignment in section.
}

- (JQCollectionViewItemsDirection)collectionView:(UICollectionView *)collectionView layout:(JQCollectionViewAlignLayout *)layout itemsDirectionInSection:(NSInteger)section {
  // return the JQCollectionViewItemsDirection in section.
}

@end

The others are same as UICollectionViewFlowLayout/NSCollectionViewFlowLayout.

Author

coder-zjq, [email protected]

License

JQCollectionViewAlignLayout is available under the MIT license. See the LICENSE file for more info.

About

A custom layout object based on flow layout. Added supports for horizontal, vertical alignment and RTL direction of collection view items.(available for both UICollectionView and NSCollectionView)

Topics

align-leftalign-rightalignmentcenterleft-to-rightnscollectionviewnscollectionviewflowlayoutright-to-leftuicollectionviewuicollectionviewflowlayoutuicollectionviewlayout

Resources

Readme
MIT license
Activity

Stars

71 stars

Watchers

2 watching

Forks

15 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.