How to Insert View in Superview's View? (iOS)

前端 未结 4 1675
时光取名叫无心
时光取名叫无心 2021-01-22 17:16

I have the line of code below... How would I modify it to insert the subview in the superview\'s view named \'foo\'?

[[self superview] addSubview:copy3];
         


        
4条回答
  •  心在旅途
    2021-01-22 18:01

    You might just actually add it to 'view' instead of 'superview'.

    [[self view] addSubview:mySubview];
    

    It works just fine for me, whenever I add subviews to my parent view. Let me know if something went wrong.

提交回复
热议问题