我有uiviewController作爲主視圖,然後我添加了子視圖叫做「supporteview」。現在我在supportview上以編程方式添加按鈕。 由於某些原因,按鈕不可見,但是當我在主視圖中加載按鈕時,我能夠看到按鈕。添加子視圖,這是再次通過超級視圖
[self.view addSubview:self.supportview]; [self.view bringSubviewToFront:self.supportView]; [self.supportView addSubview:self.btn]; [self.supportView bringSubviewToFront:self.button];
我已經加入滑塊supportView然後加載按鈕。
你是動態生成按鈕,或者是裏面的故事板? –
動態生成。 – Rupinder
嘗試更新按鈕的框架。將x和y原點設置爲0.您的按鈕框架。 –