iphone - UILabel with round corners

Hi,

I have a UIView and on top of that UIImageView. I'm displaying background image in UIImageView. I need to display a label on top of the UIImageView. I would like my label to appear semi transparent and also having rounded corners. Could anyone help me how to achieve this using iPhone SDK?

thanks!

macbook, Mac OS X (10.5.5)

Posted on Dec 8, 2008 9:44 PM

Reply
5 replies

Dec 10, 2008 12:11 PM in response to darkpaw

Hi,

Thanks for your message.
That is exactly what my question is. Here are my view layers:

top layer -> UIImageView
lowest layer -> UIView


if I override drawRect of UIView and draw a rectangle with round corners then it goes good[assuming that uiimageview layer is not there otherwise my rectangle would be covered]. If i move the same code to the UIImageView derived class then my rectangle is not drawn.

thanks!

Dec 10, 2008 12:20 PM in response to neo_dapi

I don't understand why your UILabel isn't being shown? This is what I do:
backgroundView = [self newViewWithImageNamed:@"theBackground.png" atPosition:CGPointMake(x, y)];
[self addSubview:backgroundView];
myLabel = [self newLabelWithOffset:theX y:theY w:theWidth];
myLabel.text = @"My multi-line text";
myLabel.numberOfLines = 10;
[backgroundView addSubview:myLabel];

newViewWithImageNamed and newLabelWithOffset are simply methods that create the UIImageViews and UILabels. Nothing special happens in there.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

iphone - UILabel with round corners

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.