0

I was dynamically creating buttons in Xcode 6 using Swift. I happened to noticed that there are already 2 subviews in UIViewController.view.subviews. I know that they are UIViews, but I haven't been able to figure out what specific subclass they are or what they do. Does anyone have any insight on this and is it ok to delete them?

WaltersGE1
  • 813
  • 7
  • 26
  • There's a reason Apple doesn't provide a `removeAllSubviews` method. You probably shouldn't be tampering with views that were added by the internal implementation. – Greg Oct 02 '14 at 15:14
  • can you pst code and/or screen shot of the storyboard showing the document outline? – Steve Rosenberg Oct 02 '14 at 15:15
  • They are UILayouGuides. See this [question](http://stackoverflow.com/questions/19536992/what-is-uilayoutguide) – rdurand Oct 02 '14 at 15:25

1 Answers1

0

If you try logging the class of these subviews :

for (int i = 0; i < self.view.subviews.count; i++) {
    NSLog(@"%@", [self.view.subviews[i] class]);
}

You'll get :

Project[5175:589276] _UILayoutGuide
Project[5175:589276] _UILayoutGuide

You'll find more info on UILayoutGuides in this thread for example.

Community
  • 1
  • 1
rdurand
  • 7,342
  • 3
  • 39
  • 72