Search code examples
iosuiviewuibuttonsubviewaddsubview

Add button over subview which is again over a superview


I have uiviewController as main view , then i have added subview called "supporteview". Now i am adding button programmatically on supportview. the buttons are not visible due to some reason , but when i load buttons on main view i am able to see the buttons.

[self.view addSubview:self.supportview]; [self.view bringSubviewToFront:self.supportView]; [self.supportView addSubview:self.btn]; [self.supportView bringSubviewToFront:self.button];

I have added slider in supportView and then loading buttons.


Solution

  • Try to add button 1st to the supportView then add supportView to your view. You can also use view inspector to see where the button is https://www.raywenderlich.com/98356/view-debugging-in-xcode-6

    This will help you to check the frame and constraint at the runtime