Search code examples
ios5uiviewios6selfxcode4.5

IOS 6 Update code error switching views


im designing a app thats a single view application and i am adding the code so that i can switch views via a button but every-time i enter my code that was working in IOS 5 it now comes up with a error ? heres the code

#import <UIKit/UIKit.h>


@interface ViewController1 : UIViewController 


- (IBAction)home:(id)sender;


@end




#import "ViewController1.h"

#import "ViewController.h"

@interface ViewController1 ()

@end

@implementation ViewController1


- (IBAction)home:(id)sender
{
    ViewController *second =[[ViewController alloc] initWithNibName:nil bundle:nil];
    [self presentModalViewController:second animated:YES];
}

heres the error

enter image description here

thank you!! edited answers my errors now ?? enter image description here

enter image description here

enter image description here

by the way i really appreciate it and i will give you good tick by your answer once done this is the errors now??

enter image description here enter image description here


Solution

  • First of all, this is not an error but it is warning.

    And for help you can read the documents provided by Apple.

    And to remove that warning just use the below code

    [self presentViewController:second animated:YES completion:^{ }];