Top Related Projects
Chrome-style tabs in HTML/CSS.
React components for efficiently rendering large lists and tabular data
A tiny but mighty 3kb list virtualization library, with zero dependencies 💪 Supports variable heights/widths, sticky items, scrolling to index, and more!
🤖 Headless UI for Virtualizing Large Element Lists in JS/TS, React, Solid, Vue and Svelte
Quick Overview
WheelPicker is a customizable wheel picker component for iOS applications written in Swift. It provides a circular interface for selecting items, similar to the native iOS date picker, but with more flexibility and customization options.
Pros
- Highly customizable appearance and behavior
- Smooth animations and intuitive user interaction
- Supports both horizontal and vertical orientations
- Easy integration into existing iOS projects
Cons
- Limited documentation and usage examples
- May require additional styling to match specific app designs
- Not actively maintained (last update was over 2 years ago)
- Lacks accessibility features for users with disabilities
Code Examples
Creating a basic WheelPicker:
let wheelPicker = WheelPicker()
wheelPicker.frame = CGRect(x: 0, y: 0, width: 300, height: 200)
wheelPicker.delegate = self
wheelPicker.dataSource = self
view.addSubview(wheelPicker)
Customizing the appearance:
wheelPicker.textColor = .white
wheelPicker.highlightedTextColor = .yellow
wheelPicker.backgroundColor = .darkGray
wheelPicker.selectionStyle = .overlay
wheelPicker.selectionOverlayColor = UIColor.blue.withAlphaComponent(0.3)
Implementing the data source methods:
extension ViewController: WheelPickerDataSource {
func numberOfItems(in wheelPicker: WheelPicker) -> Int {
return 10
}
func wheelPicker(_ wheelPicker: WheelPicker, titleForItemAt index: Int) -> String {
return "Item \(index + 1)"
}
}
Getting Started
- Add the WheelPicker.swift file to your Xcode project.
- Import the module in your view controller:
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let wheelPicker = WheelPicker()
wheelPicker.frame = CGRect(x: 50, y: 100, width: 300, height: 200)
wheelPicker.delegate = self
wheelPicker.dataSource = self
view.addSubview(wheelPicker)
}
}
extension ViewController: WheelPickerDelegate, WheelPickerDataSource {
// Implement delegate and data source methods here
}
- Customize the appearance and behavior as needed using the available properties and methods.
Competitor Comparisons
Chrome-style tabs in HTML/CSS.
Pros of Chrome Tabs
- Provides a realistic Chrome-like tab interface for web applications
- Supports drag-and-drop functionality for tab reordering
- Includes smooth animations for tab interactions
Cons of Chrome Tabs
- Limited to mimicking Chrome's tab style, less customizable
- Focused on browser-like tabs, not suitable for other picker interfaces
- Requires more setup for integration into existing projects
Code Comparison
WheelPicker:
const wheelPicker = new WheelPicker({
element: document.getElementById('picker'),
data: ['Option 1', 'Option 2', 'Option 3'],
onChange: (selectedIndex) => {
console.log('Selected:', selectedIndex);
}
});
Chrome Tabs:
const tabEl = document.querySelector('.chrome-tabs');
const chromeTabs = new ChromeTabs();
chromeTabs.init(tabEl);
chromeTabs.addTab({
title: 'New Tab',
favicon: false
});
Summary
WheelPicker is a versatile picker component for various selection interfaces, while Chrome Tabs specifically emulates Chrome's tab behavior. WheelPicker offers more flexibility for different types of selection needs, whereas Chrome Tabs excels in creating a familiar browser-like tab experience. The choice between the two depends on the specific requirements of the project and the desired user interface style.
React components for efficiently rendering large lists and tabular data
Pros of react-window
- Highly optimized for rendering large lists and grids
- Supports both fixed and variable size items
- Extensive documentation and examples
Cons of react-window
- More complex setup and configuration
- Limited built-in styling options
- Requires additional libraries for advanced features
Code Comparison
WheelPicker:
<WheelPicker
data={['Option 1', 'Option 2', 'Option 3']}
onChange={(selectedIndex) => console.log(selectedIndex)}
/>
react-window:
import { FixedSizeList as List } from 'react-window';
<List
height={150}
itemCount={1000}
itemSize={35}
width={300}
>
{({ index, style }) => (
<div style={style}>Row {index}</div>
)}
</List>
Summary
WheelPicker is a simpler, more specialized component for creating wheel-style pickers, while react-window is a more versatile and performant solution for rendering large lists and grids. WheelPicker offers easier implementation for specific use cases, but react-window provides greater flexibility and optimization for handling large datasets. The choice between the two depends on the specific requirements of your project and the complexity of the data you need to render.
A tiny but mighty 3kb list virtualization library, with zero dependencies 💪 Supports variable heights/widths, sticky items, scrolling to index, and more!
Pros of react-tiny-virtual-list
- Highly performant for rendering large lists with minimal DOM elements
- Supports both fixed and variable height items
- Lightweight and focused on a single purpose
Cons of react-tiny-virtual-list
- Limited to vertical list rendering
- Requires more setup and configuration compared to simpler list components
- Less suitable for small lists or when all items need to be rendered at once
Code Comparison
WheelPicker:
<WheelPicker
data={['Option 1', 'Option 2', 'Option 3']}
onChange={(selectedIndex) => console.log(selectedIndex)}
/>
react-tiny-virtual-list:
<VirtualList
width='100%'
height={600}
itemCount={1000}
itemSize={50}
renderItem={({ index, style }) => (
<div style={style}>Item {index}</div>
)}
/>
The code comparison shows that WheelPicker is more focused on creating a wheel-like selection interface, while react-tiny-virtual-list is designed for efficient rendering of large lists with customizable item rendering. WheelPicker has a simpler API for basic use cases, whereas react-tiny-virtual-list offers more control over list rendering and performance optimization.
🤖 Headless UI for Virtualizing Large Element Lists in JS/TS, React, Solid, Vue and Svelte
Pros of Virtual
- More versatile, supporting various UI frameworks (React, Vue, Solid, etc.)
- Offers advanced features like dynamic item sizes and horizontal scrolling
- Actively maintained with frequent updates and a large community
Cons of Virtual
- More complex setup and configuration required
- Steeper learning curve due to its extensive API and options
- May be overkill for simpler use cases or smaller projects
Code Comparison
WheelPicker:
<WheelPicker
data={['Option 1', 'Option 2', 'Option 3']}
onChange={selectedIndex => console.log(selectedIndex)}
/>
Virtual:
import { useVirtualizer } from '@tanstack/react-virtual'
const virtualizer = useVirtualizer({
count: 10000,
getScrollElement: () => parentRef.current,
estimateSize: () => 35,
})
{virtualizer.getVirtualItems().map((virtualItem) => (
<div key={virtualItem.key} style={{
height: `${virtualItem.size}px`,
transform: `translateY(${virtualItem.start}px)`
}}>
Item {virtualItem.index}
</div>
))}
Summary
WheelPicker is a simpler, more focused solution for creating wheel-style pickers, while Virtual offers a more powerful and flexible virtualization library for handling large lists across various frameworks. WheelPicker is easier to implement for basic use cases, but Virtual provides more advanced features and better performance for complex scenarios.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Overview
Contact
Preview
Demo
Include
Compile
compile 'cn.aigestudio.wheelpicker:WheelPicker:1.1.3'
or
<dependency>
<groupId>cn.aigestudio.wheelpicker</groupId>
<artifactId>WheelPicker</artifactId>
<version>1.1.3</version>
<type>pom</type>
</dependency>
or
<dependency org='cn.aigestudio.wheelpicker' name='WheelPicker' rev='1.1.3'>
<artifact name='$AID' ext='pom'></artifact>
</dependency>
Import aar
Import Module
1.Import moudle WheelPicker in your project.
2.Add module like below in your settings.gradle file of project:
include ':YourMoudle',':WheelPicker'
Notably, in some version of gradle you need to add module single line:
include ':WheelPicker'
click the "sycn now" when it appear on the top-right of IDE window.
3.Compile project like below in the dependencies in your build.gradle file of application module:
compile project(':WheelPicker')
Usage
Versions
1.0.0 beta
- Preview for WheelPicker and support few function.
1.0.1 beta
- BugFix:Cache in WheelCuredPicker can not clean...a stupid mistake.
1.0.2 beta
- BugFix:MotionEvent lost when point outside of view in WheelCurvedPicker
1.0.3 beta
- BugFix:Error parameter after scroll using setXXX method
1.1.0 Stable
- Refactor project fix all known bug and some function additions
- I will create a tag for old beta version but not be updated anymore
- éæ项ç®åå¸ç¨³å®çä¿®å¤æµè¯çææBUG以åæ°å¢åè½
- Betaçæ¬ä¼æä¸TAGæ¹ä¾¿èçæ¬è¿æ¸¡ä½ä¸åæ´æ°
1.1.1
- BugFix:Scroll automatically when touch but not move on WheelPicker in some low resolution phone
- BugFix:Scroll range incorrect when invoke setData twice and set data source's length less than last
- BugFix:Wheel state do not refresh when invoke setData twice and set data source's length-1 less than last selected position
- BugFix:Switch between click and scroll event
- BugFix:Call OnItemSelectedListener more time when user want to scroll continuously
- BugFix:Scroll range incorrect when set current selected item again
- BugFix:Scroll will be triggered when click WheelPicker
- Function:All the parameters of WheelPicker will be reset when you setData
- ADD WheelYearPicker, WheelMonthPicker, WheelDayPicker
- ADD WheelDatePicker
- ä¿®å¤æäºä½å辨çææºè§¦æ¸ä¸å¨æ¶èªæ»å¨é®é¢
- ä¿®å¤ç¬¬äºæ¬¡è°ç¨setData设置é¿åº¦æ¯ä¸æ¬¡å°çæ°æ®æ¶æ»å¨èå´ä¸æ¹åçé®é¢
- ä¿®å¤ç¬¬äºæ¬¡è°ç¨setData设置é¿åº¦ä½ç½®å°äºä¸æ¬¡éä¸ä½ç½®æ¶æ»è½®ç¶æä¸å·æ°é®é¢
- ä¿®å¤ç¹å»ä¸æ»å¨äºä»¶åæ¢çé®é¢
- ä¿®å¤å½ç¨æ·æ³è¿ç»æ»å¨æ¶åºç°å¤æ¬¡åè°çé®é¢
- ä¿®å¤éæ°è®¾ç½®éæ©çæ°æ®é¡¹ä½ç½®åæ»å¨èå´éä½é®é¢
- ä¿®å¤ç¹å»å触åæ»å¨çé®é¢
- éæ°è®¾ç½®æ°æ®æºåä¼éç½®æ»è½®éæ©å¨ç¸å ³åæ°
- æ°å¢å¹´ä»½ãæ份ãæ¥æéæ©å¨
- æ°å¢ä¸çº§èå¨çæ¥æéæ©å¨
1.1.2
- BugFix:WheelPicker can not get the height in some layout
- Support Android Nougat
1.1.3
- BugFix:Divide by zero
Function
- Data display circulation
- Set visible item count
- Get the current item data straight in stationary
- Monitor status of scroll get selected item data and other parameter when wheel stop
- Dynamic update data
- Set text color of selected or non-selected item
- Set item space
- Support display indicator and set the indicator's size and color
- Support display curtain and set the curtain's color
- Enable atmospheric effect
- Enable perspective effect
- Curl the items base on mathematic models
- Support item align when perspective or atmospheric enable
- 循ç¯æ¾ç¤ºæ°æ®é¡¹
- 设置å¯è§æ°æ®é¡¹æ¡æ°
- å¨æ»è½®éæ¢ç¶æç´æ¥è·åéä¸æ°æ®é¡¹
- æ»å¨çå¬è·åæ»è½®åæ¢åéä¸é¡¹ä»¥åæ»å¨å项åæ°
- å¨ææ´æ°æ°æ®æº
- 设置å½åéä¸é¡¹ææ¬é¢è²åééä¸é¡¹ææ¬é¢è²
- 设置æ°æ®é¡¹ä¹é´é´é
- æ¯æç»å¶æ示å¨ä»¥åæå®æ示å¨é¢è²ã尺寸
- æ¯æç»å¶å¹å¸ä»¥åæå®å¹å¸é¢è²
- å¯å¼å¯æ°æ®é¡¹ç©ºæ°æ模æ
- å¯å¼å¯æ°æ®é¡¹æ¨¡æçå®éè§ææ
- æ ¹æ®ä¸¥æ ¼æ°å¦å»ºæ¨¡æ¨¡ææ»è½®å¼¯æ²ææ
- å¨å¼å¯éè§æ弯æ²ææåæ¯æ让æ°æ®é¡¹å·¦å³å¯¹é½
Widgets
WheelDatePicker
Method
- setVisibleItemCount
- setCyclic
- setSelectedItemTextColor
- setItemTextColor
- setItemTextSize
- setItemSpace
- setIndicator
- setIndicatorColor
- setIndicatorSize
- setCurtain
- setCurtainColor
- setAtmospheric
- setCurved
- setItemAlignYear
- setItemAlignDay
- setYearFrame
- setSelectedYear
- setSelectedMonth
- setSelectedDay
- etc...
WheelYearPicker
Method
- All method of WheelPicker
- setYearFrame
- set/getYearStart
- set/getYearEnd
- set/getSelectedYear
- getCurrentYear
WheelMonthPicker
Method
- All method of WheelPicker
- set/getSelectedMonth
- getCurrentMonth
WheelDayPicker
Method
- All method of WheelPicker
- set/getSelectedDay
- getCurrentDay
- setYearAndMonth
- set/getYear
- set/getMonth
WheelAreaPicker
ä¸å½è¡æ¿åºåååæ ¹æ®å½å®¶ç»è®¡å±ææ°æ°æ®å½å®¶ç»è®¡å±è¡æ¿åºååå
Donation
å¦ææ¨è§å¾è¯¥é¡¹ç®å¸®å©äºæ¨é£ä¸å¦¨èµå°å¼ä¸æ¯åå¡é± :)
You can support the project and thank the author for his hard work :)
- PayPal:xiaoaibaby@vip.qq.com
LICENSE
Copyright 2015-2017 AigeStudio
Licensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Top Related Projects
Chrome-style tabs in HTML/CSS.
React components for efficiently rendering large lists and tabular data
A tiny but mighty 3kb list virtualization library, with zero dependencies 💪 Supports variable heights/widths, sticky items, scrolling to index, and more!
🤖 Headless UI for Virtualizing Large Element Lists in JS/TS, React, Solid, Vue and Svelte
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot