Giter VIP home page Giter VIP logo

tagcelllayout's Introduction

TagCellLayout

Build Status Badge w/ Version Badge w/ Platform License MIT

About

Its an ui-collection-view LAYOUT class that takes care of all the logic behind making tags like layout using UICollectionView. It also allows you to adjust the alignment of your layout i.e Left || Centre || Right. Now you just have to take care of your tag view and nothing else. Aaaand it also supports multi-line tags ๐Ÿš€

Screenshots

Center Alignment Left Alignment Right Alignment

Usage

  • Init Method:
import TagCellLayout

let tagCellLayout = TagCellLayout(alignment: .center, delegate: self)
collectionView.collectionViewLayout = tagCellLayout
  • Tag Alignment:

alignment can be Left or Center or Right. If its nil then by default Left alignment will be applied.

Delegate Methods

  • Protocol to conform - TagCellLayoutDelegate

  • Methods

- 	func tagCellLayoutTagSize(layout: TagCellLayout, atIndex index:Int) -> CGSize

Architecture

  • func tagCellLayoutTagSize(layout: TagCellLayout, atIndex index:Int) -> CGSize

is called for every tag where you will calculate their size and pass it on to TagCellLayout class for further calculations.

  • collectionView.numberOfItemsInSection(0)

internally the number of tags is calculated by the above method.

Installation

To integrate TagCellLayout into your Xcode project using CocoaPods, specify it in your Podfile:

Swift-4.0

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

pod 'TagCellLayout', :git => 'https://github.com/riteshhgupta/TagCellLayout.git'

Swift-3.2

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

pod 'TagCellLayout', :git => 'https://github.com/riteshhgupta/TagCellLayout.git', :branch => 'swift3.2'

Swift-3.0

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

pod 'TagCellLayout', :git => 'https://github.com/riteshhgupta/TagCellLayout.git', :branch => 'swift3.0'

Swift-2.3

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

pod 'TagCellLayout', :git => 'https://github.com/riteshhgupta/TagCellLayout.git', :branch => 'swift2.3'

Swift-2.2

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

pod 'TagCellLayout', '~> 0.3'

Contributing

Open an issue or send pull request here.

Licence

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

tagcelllayout's People

Contributors

naeemshaikh90 avatar riteshgupta-fueled avatar riteshhgupta avatar spacecaps-cao avatar wei18 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

tagcelllayout's Issues

Multiple or more section issue

I'm trying to add two sections but it has different custom cell but it won't enter second section if I set the TagCellLayout. So is there a way for it? @riteshhgupta

Thanks in advanced.

Tag view height is incorrect

Hi,
I am trying to fetch the size of collection view height from the override method collectionViewContentSize in TagCellLayout, which is total height of tag cells in the collection view, that might be incorrect in the case of multiple cells in a row. Currently I am using the latest version 1.0.

Prior to the latest version, I was using 0.3, in which the collectionViewContentSize is calculated from the number of lines property and that was returning correct value. Does anyone get similar kind of issue.

Row count

Could you add function that return row count?
I added this function by my own but I forgot to save it before update )=

Hi

Hey @riteshhgupta
I just want to make TagCellLayout horizontally and want to reduce vertically space between two items. Please let me know the correct way.

Thanks in advance.

Make properties as IBInspectible

It would be nice to have properties like delegate and tagAlignmentType as IBInspectible. It will be helpful in setting these values by storyboard without having to write a single line of code for initialization.

Multiline not working

Hello,

I have a problem with your class TagCelLayout, in iPhone 5S, the multiline not working.
capture d ecran 2018-07-20 a 12 04 00

I see that the collection view width is not representative to the reality with iPhone 5s in the function shouldMoveTagToNextRow.
It work perfectly on iPhone 6s.

If you need more informations, please contact me :)

Distance Between Cells

Implement a function like from UICollectionViewFlowLayoutDelegate

- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionView *)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section  
  {
    return 10; // This is the minimum inter item spacing, can be more
  }

Question: Programmatically Set Section Inset?

๐Ÿ‘‹ Ritesh -

I'm having trouble setting the insets for my CollectionView programmatically (I'm not using a story board). Right now it's taking up the entire view, but I need it to appear below some text and above a button at the bottom of the view.

For a typical UICollectionView I've used sectionInset to set it in the proper position:

let layout: UICollectionViewFlowLayout = UICollectionViewFlowLayout()
layout.sectionInset = UIEdgeInsets(top: 178, left: 10, bottom: 40, right: 10)
collectionView = UICollectionView(frame: self.view.frame, collectionViewLayout: layout)

This doesn't seem to work for tagCellLayout. Any ideas?

Thanks for the help ๐Ÿ˜Š

pod install issue

When i install this wonderful tools with cocoapods, there is an exception saying
"TagCellLayout (~> 0.2)required byPodfile".
But if i try to use 0.1 version, it could not find the 0.1 branch.
"Remote branch 0.1.0 not found in upstream origin"
thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.