The RingView is a view used to select one from a large number of items.
Scroll bars are commonly used for the purpose. But scrolling takes long when there are a lot of items. Instead of scrolling, users can control the RingView by pan gestures. Pan gestures from the inside of the ring to the outside change the scale of the RingView and users can zoom in the destination items.
The RingView is based on the paper by Koshizawa et al �[1�]__ although the details of the implementation are different because of the optimizations for touchscreens.
- iOS 4.3 and later
Put the following files into your project.
- iOS/RingView/KUIRingView.h
- iOS/RingView/KUIRingView.m
The KUIRingView class can be used like the UITableView class. As the UITableView needs the UITableViewDataSource and the UITableViewDelegate, the KUIRingView needs the KUIRingViewDataSource and the KUIRingViewDelegate.
The following is the typical code to use the KUIRingView.
#import "KUIRingView.h"
@interface ViewController : UIViewController <KUIRingViewDelegate, KUIRingViewDataSource>
@property (nonatomic, strong) IBOutlet KUIRingView *ringView;
...
@end
@implementation KUIViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.ringView.delegate = self;
self.ringView.dataSource = self;
}
- (NSUInteger)ringViewNumberOfItems:(KUIRingView *)ringView {
...
return numberOfItems;
}
- (KUIRingViewItem *)ringView:(KUIRingView *)ringView itemAtIndex:(NSUInteger)index {
...
return return [[KUIRingViewItem alloc] initWithTitle:title];
}
- (void)ringView:(KUIRingView *)ringView didSelectItemAtIndex:(NSUInteger)index {
...
}
...
@end
- Open the Xcode project.
- Chose "Samples" as the build target.
- Run the project.
MIT License. Read the LICENSE file.