Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to display the text in slanted style? #41

Closed
YifanDengWHU opened this issue Aug 6, 2019 · 4 comments
Closed

How to display the text in slanted style? #41

YifanDengWHU opened this issue Aug 6, 2019 · 4 comments

Comments

@YifanDengWHU
Copy link

Well, I have tried the demo. The demo used CustomCollectionCell as the slanted cell, but there is no any UILabel in this cell. Simply adding a UILabel to the cell can't display the text in slanted style obviously. So how does the gif showed "Highway" "AC/DC" in slanted style? Thanks for helping me out!

@yacir
Copy link
Owner

yacir commented Aug 6, 2019

You can achieve it by using the slantingAngle property. Check its documentation in the readme file you will find an example 😉

@YifanDengWHU YifanDengWHU changed the title How to dis play the text in slanted style? How to display the text in slanted style? Aug 6, 2019
@YifanDengWHU
Copy link
Author

Thanks a lot, problems have been solved!

@EralpB
Copy link

EralpB commented Aug 14, 2019

@YifanDengWHU can you share your code?

@yacir
Copy link
Owner

yacir commented Aug 14, 2019

@EralpB here is an example:

func collectionView(_ collectionView: UICollectionView, 
                    cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
   // ...
    if let layout = collectionView.collectionViewLayout as? CollectionViewSlantedLayout {
        cell.contentView.transform = CGAffineTransform(rotationAngle: layout.rotationAngle)
    }
   // ...
   return cell
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants