world000
world000

Reputation: 1537

issue: subview becoms on top of superview when it moves out of the superview

Here are two component, UIView *superView, and UILabel *label. label is a subview of superView. The issue is that the label will be on top of the superView, when I move the label out of its super view. Did not the label be invisible if it is out of its super view's frame?

Thanks!

Upvotes: 1

Views: 344

Answers (2)

Ajeet Pratap Maurya
Ajeet Pratap Maurya

Reputation: 4254

I hope that you have linked your label with your IB and used IBOutlet while declaring your UILabel. i.e in .h file

     IBOutlet UILabel *myLabel;

link myLabel with the Label you created in IB. if you have done that

just use [myLabel removeFromSuperview];

it will work.

Upvotes: 0

August Lilleaas
August Lilleaas

Reputation: 54603

UIView has a property clipsToBounds. Setting it to YES for your superView will make all views outside of its bounds be clipped.

Upvotes: 2

Related Questions