It looks like you are not properly setting the frames of the 2 subviews. You pass the origin to the init method, and that is fine to set the ANImageView frame, but not the subviews.
So let's say you pass an origin point (200, 200): the ANImageLabel view will be put in you mySuperView on (200, 200).
If you then set the 2 subviews to the same origin point, they will be put on the coordinate (200, 200) in relation to the ANImageLabel frame, so they may fall outside the actual view frame. To be more precise
|''''''''''''''| -> your mySuperView
| |
| |
| |
| |
| |''''|--- |----> you ANImageView on (200, 200)
| | | |
| '''''' |
| |
| ---|-------> somewhere around here (but inside the ANImageView) you have your 2
| | subviews, centered in relation to the ANImageViewFrame (so (400, 400)
'''''''''''''''' in relation to the mySuperView)
In this case, the 2 subviews will be outside the visible area of the ANImageView, and thus hidden. Of course if you then pick them up singularly and you put them directly in mySuperView, their origin (200, 200) will actually be relative to mySuperView frame, and probably in its visible area, so not hidden.
Just try to turn this:
CGRect imageViewFrame = CGRectZero;
imageViewFrame.origin = origin;
imageViewFrame.size = imageViewSize;
self.imageView = [[UIImageView alloc] initWithFrame:imageViewFrame];
self.imageView.contentMode = UIViewContentModeCenter;
[self addSubview:self.imageView];
CGRect labelFrame = CGRectZero;
labelFrame.origin.x = origin.x + imageViewSize.width;
labelFrame.origin.y = origin.y;
labelFrame.size = labelSize;
self.label = [[UILabel alloc] initWithFrame:labelFrame];
[self addSubview:self.label];
into this:
CGRect imageViewFrame = CGRectZero;
imageViewFrame.origin = CGPointMake(0,0);
imageViewFrame.size = imageViewSize;
self.imageView = [[UIImageView alloc] initWithFrame:imageViewFrame];
self.imageView.contentMode = UIViewContentModeCenter;
[self addSubview:self.imageView];
CGRect labelFrame = CGRectZero;
labelFrame.origin.x = imageViewSize.width;
labelFrame.origin.y = 0;
labelFrame.size = labelSize;
self.label = [[UILabel alloc] initWithFrame:labelFrame];
[self addSubview:self.label];
and see if it gets fixed.