Latest 0.1.1
Homepage https://github.com/mateuszfidosBLStream/MFCircleDialPad
License MIT
Platforms ios 8.0
Authors

Build Status
Version
License
Platform

Example

To run the example project, clone the repo, open and run Example scheme.

Requirements

ARC
iOS8

Installation

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

pod "MFCircleDialPad"

Usage

Start with some importing:

import MFCircleDialPad

Define and customize items:
You can build items with custom text, bgColor, image or size.

var items:[MFDialPadItem] = []
for idx in 0..<10
{
     items.append(MFDialPadItem(text: "(idx)", backgroundColor: nil, image: nil, radius: 60))
}

Same goes to center item:

let centerItem = MFDialPadCenterItem(backgroundColor: UIColor.clearColor(), image: nil, radius: 80)

If you want to you can define some additional assets for when dial pad changes state (value) so your center item can have more than one image (there are already some assets in the pod that you can use – see example)

centerItem.setImageForState(UIImage(named: "phonecallarrow")!, state: MFDialPadItemState.MFDialPadItemStateDefault)
centerItem.setImageForState(UIImage(named: "phonecallgreen")!, state: MFDialPadItemState.MFDialPadItemStateValid)
centerItem.setImageForState(UIImage(named: "phonecallred")!, state: MFDialPadItemState.MFDialPadItemStateInvalid)

So everytime this delegate method gets called:

public protocol MFDialPadControlDelegate
{
    func dialPadDidChangeValue(value:Int)
}

you can check if number you’ve chosen is actually a valid phone number:

func dialPadDidChangeValue(value: Int)
{
    self.numberField.text = self.numberField.text?.stringByAppendingString("(value)")
    self.control.updateCenterItemIfValid(self.numberField.text!)
}

Also you can conform to

MFDialPadOrientationHandlerDelegate

to receive notifications everytime orientation changes

func orientationDidChange(orientation: UIDeviceOrientation)
{
    self.control.center = self.view.center
    self.control.updatePosition()
}

This method helps pad control to adjust its size or radius when there is not enough space to draw and collision is detected

self.control.updatePosition()

Note:

Inspired by: https://github.com/Ramotion/circle-menu

Author

Mateusz Fidos, [email protected]

License

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

Latest podspec

{
    "name": "MFCircleDialPad",
    "version": "0.1.1",
    "summary": "A circular, customizable dial pad",
    "description": "Small customizable UI componetnt allowing you to perform calls from your app. Inspired by: https://github.com/Ramotion/circle-menu",
    "homepage": "https://github.com/mateuszfidosBLStream/MFCircleDialPad",
    "license": "MIT",
    "authors": {
        "Mateusz Fidos": "[email protected]"
    },
    "source": {
        "git": "https://github.com/mateuszfidosBLStream/MFCircleDialPad.git",
        "tag": "0.1.1"
    },
    "social_media_url": "https://twitter.com/@mateuszfidos",
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "MFCircleDialPad/**/*"
}

Pin It on Pinterest

Share This