我有uiviewController作为主视图,然后我添加了名为“supporteview”的子视图 . 现在我在supportview上以编程方式添加按钮 . 由于某种原因,按钮不可见,但当我在主视图上加载按钮时,我能够看到按钮 .
[self.view addSubview:self.supportview]; [self.view bringSubviewToFront:self.supportView]; [self.supportView addSubview:self.btn]; [self.supportView bringSubviewToFront:self.button];
我在supportView中添加了滑块,然后加载按钮 .
1 回答
尝试将第1个按钮添加到supportView,然后将supportView添加到您的视图中 . 您还可以使用视图检查器查看按钮的位置https://www.raywenderlich.com/98356/view-debugging-in-xcode-6
这将帮助您在运行时检查框架和约束