开发者

Warning from AppDelegate

I am getting the following warning when I am calling other view controllers..

WindowMultivewAppDelegate might not respond to -switchView to view

This is my code in the Firstviewcontroller.m

- (IBAction)swapViews:(id)sender{

WindowMultiViewAppDelegate *delegate = (WindowMultiViewAppDelegate *)[[UIApplication       sharedApplication] delegate];
SecondViewController *secondView = [[SecondViewController alloc]    initWithNibName:@"SecondViewController" bundle:nil];
[delegate switchView:self toView:secondView.view];

 }

this is my code in the Firstviewcontroller.h

#import <UIKit/UIKit.h>


@interface FirstViewController : UIViewController {



}

- (IBAction)swapViews:(id)sender;

@end

in the appdelegate.m

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:     (NSDictionary *)launchOptions {    


 initWithNibName:@"FirstViewController" bundle:nil];
[self.window addSubview:navigationController.view];

locationManager = [[CLLocationManager alloc] init];
locationManager.distanceFilter = kCLDistanceFilterNone; // whenever we move
locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters; // 100 m
if ([CLLocationManager locationServicesEnabled]) {

    [locationManager startUpdatingLocation];     
}



[self.window makeKeyAndVisible];

return YES;
}

in the appdelegate.h

@interface WindowMultiViewAppDelegate : NSObject <UIApplicationDelegate,     CLLocationManagerDelegate , MKMapViewDelegate> {
UIWindow *window;
UINavigationController *navigationController;

CLLocationManager *locationManager;



}


@property (开发者_开发知识库nonatomic, retain) IBOutlet UIWindow *window;

@property (nonatomic, retain) IBOutlet CLLocationManager *locationManager;

@property (nonatomic, retain) IBOutlet UINavigationController *navigationController;

@end

I have placed a UInavgationcontroller into the mainWindow.xib which leads to the rootviewcontroller which i named FirstViewController

The application quites in the secondviewcontroller when a button next is pressed which has that action inside

- (IBAction)swapNext:(id)sender
{
WindowMultiViewAppDelegate *delegate = (WindowMultiViewAppDelegate *)[[UIApplication sharedApplication] delegate];
MediaViewController *mediaView = [[MediaViewController alloc] initWithNibName:@"MediaViewController" bundle:nil];
[delegate switchView:self toView:mediaView.view];

}

What am I doing wrong??

Can anybody tell me how to connect more subviews into the UINavigationController I want one of this subviews to be a video player - offline- and the other one to be a map which find the user"s location

I am a beginner.... thank you all when I learn I am going to help others :))


I don't see that you define the switchView: method anywhere, so it's no surprise that you get a warning about this.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜