在我的UIVIewController
中有一個UIButton。要實現按鈕將它推入到UIView中,但是我寫完代碼運行之後報出警報:incompatible pointer type sending
代碼:
-(void)press{
displayView *disp=[[displayView alloc]init];
[self presentModalViewController:disp animated:No];
}
不知道哪裡出錯了,請指教。
presentModalViewController
接受UIViewController
實例(不是UIView). 如果想顯示特定視圖,要放在視圖管理器中:
UIViewController *viewController = [[UIViewController alloc] init];
DisplayView *displayView = [[DisplayView alloc] init];
[viewController.view addSubview: displayView];
[self presentModalViewController:viewController animated:NO];