Hello,
I've placed an image in my UIView with IB.
How do I move this image around, resize it, etc programmatically? I cannot figure out how to reference it from my code.
Thanks a zillion.
Hello,
I've placed an image in my UIView with IB.
How do I move this image around, resize it, etc programmatically? I cannot figure out how to reference it from my code.
Thanks a zillion.
You need to make it an IBOutlet
.
So in your viewController
, or whatever you are loading from the nib
, declare it like this:
IBOUtlet UIImageView *myImageView;
Also, in the actual nib
, you must connect the File's Owner
object to the UIImageView
in your file by right-clicking File's owner
and dragging the correct outlet name (in this case, myImageView
) onto the correct UIImageView
instance in your nib
.
Now when you load one of the objects using the nib
, myImageView will point to the initialized UIImageView
, or whatever else you have.
So if you create an UILabel in Inteface Builder, create an outlet like so in your .h file:
IBOutlet UIlabel* somelabel;
Then hook it up in Interface Builder and then you can access it like so:
somelabel.text = @"something";