我有一個圖形視圖,我想重疊一些按鈕。當我使用按鈕創建一個筆尖並在添加圖形後將其添加爲子視圖時,它只是在白色屏幕上顯示按鈕。如何在iOS上堆疊子視圖?
GraphViewController *graphViewController = [[GraphViewController alloc] init];
[self.view addSubview:graphViewController.view];
GraphButtonViewController *graphButtonViewController = [[GraphButtonViewController alloc] initWithNibName:@"GraphButtonView" bundle:nil];
[self.view addSubview:graphButtonViewController.view];
那麼GraphButtonView會保存按鈕?那「GraphButton」將會在「GraphView」中?如果是這樣,您可以簡單地添加GraphButtonViewController.view作爲圖形視圖的子視圖 [graphViewController.view addSubview:graphButtonViewController.view]; – 2011-03-02 00:29:47