Home

Awesome

FrameAccessor

Build Status Coverage Status

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

Compatibility

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:

PropertyTypeАvailability
viewOriginCGPointreadwrite
viewSizeCGSizereadwrite
x, yCGFloatreadwrite
width, heightCGFloatreadwrite
top, left, bottom, rightCGFloatreadwrite
centerX, centerYCGFloatreadwrite
middlePointCGPointreadonly
middleX, middleYCGFloatreadonly

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:

PropertyTypeАvailability
contentOffsetX, contentOffsetYCGFloatreadwrite
contentSizeWidth, contentSizeHeightCGFloatreadwrite
contentInsetTop, contentInsetLeft, <br>contentInsetBottom, contentInsetRightCGFloatreadwrite

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.