Skip to content

A Rotary Wheel for altering content that can be customised in Interface Builder

Notifications You must be signed in to change notification settings

HannahCarney/HCRotaryWheel

Repository files navigation

HCRotaryWheel

A Rotary Wheel for altering content that can be customised in Interface Builder

Currently allows for up to 12 sectors in Interface Builder

Feel free to open an issue here for added functionality

Demo CountPages alpha

Functionality

  • Rotates on a Timer until Wheel is touched
  • Timer shuts off and then can be dragged or touched to spin the wheel
  • Functionality for changing any content when wheel turns
  • Background, number of elements, size, images and color of images can be changed in the Interface Builder
  • Circular or square icons surrounding the images
  • Drop shadows can be toggled
  • Different section borders can be toggled on or off, background can be customized also

alt text

alt text

Pod Installation

HCRotaryWheel is available through CocoaPods. To install it, simply add the following line to your Podfile:

use_frameworks!
pod 'HCRotaryWheel', '~> 1.1'

Note

adding use_frameworks! allows for Cocoapods to parse IBDesignable elements

Manual Installation

  1. Clone Project
  2. Build in Xcode for example project
  3. Drag Controls folder into your project
  4. Enter class in Identity Inspector

Chicago commercial photographers

Edit in Attributes Inspector

Chicago commercial photographers

How to use Objective-C

In your ViewController.h drag your HCRotaryWheelView as an IBOutlet and add RotaryProtocol to call Delegate Methods

#import "HCRotaryWheel.h"

@interface ViewController : UIViewController <RotaryProtocol>

  @property (weak, nonatomic) IBOutlet UILabel *textLabel;
  @property (weak, nonatomic) IBOutlet HCRotaryWheelView *rotaryWheelView;

@end

In ViewController.m

- (void)viewDidLoad {
  [super viewDidLoad];
  //set view controller as delegate to Rotary Wheel
  self.rotaryWheelView.delegate = self;
  //set initial Text for a label or other content
  self.textLabel.text = @"Bear";
}

// built in HCRotaryWheel Delegate Method
 - (void) wheelDidChangeValue:(int)currentSector {
   // change any text when wheel rotates, is tapped or dragged
   self.textLabel.text = [self getDescriptionText:currentSector];
 }

- (NSString *) getDescriptionText:(int)newValue {
  NSString *text = @"";
    switch(newValue) {
      case 0:
          text = @"Bear";
          break;
      case 1:
          text = @"Monkey";
          break;
      case 2:
           text = @"Dog";
          break;
     case 3:
          text = @"Ghost";
         break;
      case 4:
          text = @"Peace";
          break;
      case 5:
          text = @"Alien";
          break;
      default:
          break;
    }
    return text;
}

How to use Swift

import UIKit
import HCRotaryWheel

class ViewController: UIViewController, RotaryProtocol {

    
    @IBOutlet weak var textField: UITextField!
    @IBOutlet weak var hcview: HCRotaryWheel!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        self.hcview.delegate = self
        self.textField.text = "Bear"
        // Do any additional setup after loading the view, typically from a nib.
    }

    func wheelDidChangeValue(currentSector: Int32) {
        self.textField.text = self.getDescriptionText(currentSector);
    }
    
    func getDescriptionText(newValue :Int32) -> String
    {
        switch newValue {
        case 0:
            return "Bear"
        case 1:
            return "Monkey"
        case 2:
            return "Dog"
        case 3:
            return "Ghost"
        case 4:
            return "Peace"
        case 5:
            return "Alien"
        default:
            return "Bear"
        }
    }

Author

Hannah Carney, [email protected]

License

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

About

A Rotary Wheel for altering content that can be customised in Interface Builder

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published