Adding UILabel to UIImageView

Is there a way when I could add a UILabel on top of a UIImageView programmatically?

So, at the end of the image should be an inscription.

+8
objective-c iphone cocoa-touch
source share
2 answers

UIImageView is a subclass of UIView, so you can add any interface object to it.

 UILabel *xlabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 50, 20)]; xlabel.text = @"xxx"; [myImageView addSubview:xLabel]; 
+11
source share

Easier than

 [imageView addSubview:yourLabel]; 
+5
source share

All Articles