Sorry guys, I hate asking dumb questions but I have seriously been searching for days online to no avail. Every method I've tried with item.bounds
or the like has failed miserably. I'm just trying to move some elements, like a UILabel
and a UIButton
over a few pixels under a certain circumstance. Just a simple point to a tutorial that I missed would be开发者_JAVA百科 so helpful.
Generally frame is what you want. It is specified in terms of parent view coordinates. So if my view's frame is CGRectMake(10.f,20.f,50.f,60.f)
it appears in the parent's coordinates at x=10 y=20 with width 50 and height 60.
UIView* someView ...
CGRect someViewFrame = someView.frame;
someView.frame.origin.y += 10;
someView.frame = someViewFrame;
moves the view down by 10 pixels.
If you just want to move the view in a superview, leave bounds alone.
This example should be useful.
精彩评论