SameSung Vs Iphone
SameSung Vs Iphone

Reputation: 614

Pushing UIVIewController to UIView

I have a UIButton in UIVIewController and I need to push it to the UIVIew when I press the button.But this gives me the warning of incompatible pointer type sending

how to do this What I am doing this:

-(void)press{
    displayView *disp=[[displayView alloc]init];
    [self presentModalViewController:disp animated:No];
}

this gives me warning and crashes my application.

Upvotes: 1

Views: 476

Answers (1)

Edwin Iskandar
Edwin Iskandar

Reputation: 4119

presentModalViewController accepts a UIViewController instance (not UIView). If you want to display a particular view, place it within a view controller first.

UIViewController *viewController = [[UIViewController alloc] init];
DisplayView *displayView = [[DisplayView alloc] init];
[viewController.view addSubview: displayView];
[self presentModalViewController:viewController animated:NO];

Upvotes: 4

Related Questions