Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pujiaxin33/jxmarqueeview
A powerful and easy to use marquee view.
https://github.com/pujiaxin33/jxmarqueeview
marquee swift
Last synced: 5 days ago
JSON representation
A powerful and easy to use marquee view.
- Host: GitHub
- URL: https://github.com/pujiaxin33/jxmarqueeview
- Owner: pujiaxin33
- License: mit
- Created: 2018-05-02T03:36:09.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2024-07-08T07:13:27.000Z (8 months ago)
- Last Synced: 2025-02-15T17:56:03.589Z (5 days ago)
- Topics: marquee, swift
- Language: Swift
- Size: 12.9 MB
- Stars: 386
- Watchers: 11
- Forks: 69
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# JXMarqueeView
[](https://developer.apple.com/swift)
[](#)
[](https://cocoapods.org/pods/JXMarqueeView)A powerful and easy to use marquee view.
[中文博客介绍](https://www.jianshu.com/p/835ba205453d)
# Features
- Automatically start marquee. (When the content beyond size, marquee start automatically.)
- Support UIView an its subclasses. (More than just UILabel, you can customize the view to turn on the marquee effect.)# Preview
`JXMarqueeType.left`:From right to left

`JXMarqueeType.right`:From left to right

`JXMarqueeType.reverse`:reverse

# Requirements
- XCode 9.0+
- Swift 5.0+ (greater or equal 0.0.8 version)# Installation
1. Manually
- Download source code, drag JXMarqueeView.swift file into your project.
2. Cocoapods
```ruby
use_frameworks!
target '' do
pod 'JXMarqueeView'
end
```# Usage
- **contentMargin**
The interval between two views,default is 12.
- **frameInterval**
Assiagned to CADisplayLink frameInterval property,default is 1.
- **pointsPerFrame**
How many points each time for callback of CADisplayLink.The bigger the faster.
- **contentView**
The view your need to marquee.
- **SizeToFit**
When you customize complex content view, you need override `func sizeThatFits(_ size: CGSize) -> CGSize`,and return you correct content size.
## Use case
```swift
//text
let label = UILabel()
label.textColor = UIColor.red
label.font = UIFont.systemFont(ofSize: 30, weight: .medium)
label.text = "abcdefghijklmnopqrstuvwxyz"marqueeView.contentView = label
marqueeView.contentMargin = 50
marqueeView.marqueeType = .left
self.view.addSubview(marqueeView)//picture
let imageView = UIImageView(image: UIImage(named: "haizeiwang.jpeg"))
imageView.contentMode = .scaleAspectFillmarqueeView.contentView = imageView
marqueeView.marqueeType = .reverse
self.view.addSubview(marqueeView)
```## Customize
The default implementation of contentView's copy using code:
```
let archivedData = NSKeyedArchiver.archivedData(withRootObject: self)
let copyView = NSKeyedUnarchiver.unarchiveObject(with: archivedData) as! UIView
```
But if the view has cornerRadius、shadow, the copyView will lose it. So you should implement `protocol JXMarqueeViewCopyable` function `func copyMarqueeView() -> UIView`. Just return a new instance UIView.
Just checkout `CustomCopyView.swift` in example.### Picture case preview
### Custom case preview
