Skip to content
This repository has been archived by the owner on Feb 12, 2019. It is now read-only.

Less code to position and resize UIView objects.

License

Notifications You must be signed in to change notification settings

xzeror/uiview-frame-helpers

 
 

Repository files navigation

Drowning in layout code? Use these helpers to reduce layout code by up to 75% in common cases. See the .h file for the complete interface.

Then

CGRect frame = myView.frame;
frame.origin.x = ...
frame.origin.y = ...
myView.frame = frame;

Now

[myView setX:myXVal andY:myYVal];

Then

CGRect frame = myView.frame;
frame.origin.x = frame.origin.x + xDelta;
frame.origin.y = frame.origin.y + yDelta;
myView.frame = frame;

Now

[myView adjustX:xDelta andY:yDelta];

Then

CGRect frame = myView.frame;
frame.origin.x = myOtherView.origin.x + myOtherView.size.width + kMyPaddingConst;
frame.origin.y = myOtherView.origin.y;
myView.frame = frame;

Now

[myView insideTopEdgeOfSuperviewBy:0];
[myView outsideRightEdgeOf:myOtherView by:kMyPaddingConst];

Notes

If you are using the relative positioning helpers, e.g. insideSomeEdgeOfSuperviewBy: or outsideOtherEdgeOf:by:, make sure to call them after you've added the receiver to its superview.

The more-generic inside/outsideOf:by: methods do not depend on the view hierarchy's configuration.

About

Less code to position and resize UIView objects.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 96.7%
  • Ruby 3.3%