Latest1.0.0
Homepagehttps://github.com/rbereski/RXKeyValueColumnView
LicenseMIT
Platformsios 8.0
Authors

RXKeyValueColumnView

RXKeyValueColumnView is a lightweight view for displaying collection of text values equipped with title (key). RXKeyValueColumnView internally uses iOS UILabels and AutoLayout constraints for presentation. It is able to automatically size itself to fit the content and can be a part of more complex AutoLayout-based UIs.

SampleScreen1

Example

Main view of the sample view controller is defined in the storyboard and contains two RXKeyValueColumnViews.
Content to display in a column is represented by its items property.

   override func viewDidLoad() {
        super.viewDidLoad()

        self.firstKeyValueColumn.delegate = self
        self.secondKeyValueColumn.delegate = self

        firstKeyValueColumn.items = [
            RXKeyValue(key: "APP NAME", value: "RXKeyValueColumn Demo"),
            RXKeyValue(key: "VERSION", value: "1.0.0"),
            RXKeyValue(key: "PLATFORM", value: "iOS 8.0+"),
            RXKeyValue(key: "RELEASED", value: "10/2015"),
        ]

        secondKeyValueColumn.items = [
            RXKeyValue(key: "TAGS", value: "Custom UIViewnAuto-LayoutnPresentation"),
            RXKeyValue(key: "DESCRIPTION", value: "Cocoa Touch view for displaying key-value information.")
        ]
    }

Customization

RXKeyValueColumnView has a set of delegate methods that lets you customize UILabels and spacing between them.

extension ViewController : RXKeyValueColumnViewDelegate {
    func prepareKeyLabel(keyLabel : UILabel, inKeyValueColumn : RXKeyValueColumnView) {
        keyLabel.textColor = UIColor.blueColor()
        keyLabel.font = UIFont.boldSystemFontOfSize(12)
    }

    func prepareValueLabel(valueLabel : UILabel, inKeyValueColumn : RXKeyValueColumnView) {
        valueLabel.textColor = UIColor.darkTextColor()
        valueLabel.font = UIFont.systemFontOfSize(12)
    }

    func keyValueColumnValueSpacing(keyValueColumn: RXKeyValueColumnView) -> CGFloat {
        return 0
    }

    func keyValueColumnItemsSpacing(keyValueColumn: RXKeyValueColumnView) -> CGFloat {
        return 12
    }
}

Installation

Using CocoaPods (iOS 8+)

Add the following line to Podfile in your project:

pod 'RXKeyValueColumn', '~> 1.0'

Manually (iOS 7+)

Download and add to your project files from the RXKeyValueColumnView directory.

License

This project is released under MIT License.

Latest podspec

{
    "name": "RXKeyValueColumn",
    "version": "1.0.0",
    "summary": "Customizable view for displaying collection of key-value information.",
    "authors": {
        "Rafau0142 Bereski": "[email protected]"
    },
    "homepage": "https://github.com/rbereski/RXKeyValueColumnView",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "source": {
        "git": "https://github.com/rbereski/RXKeyValueColumnView.git",
        "tag": "1.0.0"
    },
    "source_files": "RXKeyValueColumnView",
    "platforms": {
        "ios": "8.0"
    }
}

Pin It on Pinterest

Share This