Latest 2.0
Homepage https://github.com/AlexDenisov/FrameAccessor
License MIT
Platforms ios 4.3, osx 10.6
Authors , ,

Build Status
Coverage Status

Easy way to access view’s frame in iOS and OSX.

Compatibility

  • iOS 4.3 or higher
  • OSX 10.6 or higher

Installation

Manual Install (preferred method)

Download framework for iOS or for OS X target and drag’n’drop into your project.

Add -ObjC -all_load to Other Linker Flags.

CocoaPods

Edit your Podfile and add FrameAccessor:

pod 'FrameAccessor'

Example Usage

view.x = 15.;
view.width = 167.;

instead of

CGRect newFrame = view.frame;
newFrame.origin.x = 15.;
newFrame.size.width = 167.;
view.frame = newFrame;

Available Properties

UIView/NSView properties:

Property Type –źvailability
viewOrigin CGPoint readwrite
viewSize CGSize readwrite
x, y CGFloat readwrite
width, height CGFloat readwrite
top, left, bottom, right CGFloat readwrite
centerX, centerY CGFloat readwrite
middlePoint CGPoint readonly
middleX, middleY CGFloat readonly

Note: the names of @viewOrigin and @viewSize properties are prefixed with view to not create conflicts with Apple’s private internals (As discussed in #7).

UIScrollView properties:

Property Type –źvailability
contentOffsetX, contentOffsetY CGFloat readwrite
contentSizeWidth, contentSizeHeight CGFloat readwrite
contentInsetTop, contentInsetLeft,
contentInsetBottom, contentInsetRight
CGFloat readwrite

License

FrameAccessor is available under the MIT license.

Copyright (c) 2012 Alexey Denisov

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Latest podspec

{
    "name": "FrameAccessor",
    "version": "2.0",
    "license": "MIT",
    "summary": "Easy access to view's frame.",
    "homepage": "https://github.com/AlexDenisov/FrameAccessor",
    "description": "n    You can access x, y, width, height, origin or size like properties.n    Like this:n    view.x = 15;n    view.width = 167;n  ",
    "authors": {
        "AlexDenisov": "[email protected]",
        "holgersindbaek": "[email protected]",
        "noxt": "[email protected]"
    },
    "source": {
        "git": "https://github.com/AlexDenisov/FrameAccessor.git",
        "tag": "2.0"
    },
    "platforms": {
        "ios": "4.3",
        "osx": "10.6"
    },
    "ios": {
        "source_files": "FrameAccessor/*.{h,m}"
    },
    "osx": {
        "source_files": [
            "FrameAccessor/FrameAccessor.h",
            "FrameAccessor/ViewFrameAccessor.{h,m}"
        ]
    }
}

Pin It on Pinterest

Share This