1

Is such thing possible? I have my UIScrollView created via IB and I wanted it as a subview of a UIImgeView I have, created in IB as well. If it is possible how do I do so?

xonegirlz
  • 8,889
  • 19
  • 69
  • 127

2 Answers2

2

Short answer NO. The workarounds depend on what's more important to you

1. Creating the UIImageView subview hierarchy in the xib is most important

Start with a UIView but change it's class to UIImageView

enter image description here

then set the image in code

self.myImageView.image = [UIImage imageNamed:@"someImage"];

2. Setting the image in the xib is most important

Then do as you have been doing and add the subviews in code

[self.myImageView addSubview:someSubView];

3. You want the imageView and the other view to move and scale in unison

Then place them in a container UIView that is the same size as the UIImageView

enter image description here

Here you can see a container UIView that holds the UIImageView and another subview

Paul.s
  • 38,494
  • 5
  • 70
  • 88
0

If you can't drag it into the UIImageView then I do not think it is possible,and an imageViews purpose is not meant to hold subviews. But it is just as easy to add it in code

[imageView addSubview:subView];
Otium
  • 1,098
  • 8
  • 20