ios - Not visible @interface for 'MyController' declares the selector -
i'm learning ios development , found app source sample in internet. im trying rewrite , use tabbed layout, , after copying appdelegate.m sample app, got following error:
no visible @interface 'firstviewcontroller' declares selector alloc in following line:
firstviewcontroller *firstviewcontroller = [[firstviewcontroller alloc] initwithnibname:@"firstviewcontroller" bundle:nil]; this full appdelegate:
#import "appdelegate.h" #import "firstviewcontroller.h" @implementation appdelegate - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { self.window = [[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]]; // override point customization after application launch. firstviewcontroller *firstviewcontroller = [[firstviewcontroller alloc] initwithnibname:@"firstviewcontroller" bundle:nil]; self.navigationcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:firstviewcontroller]; self.navigationcontroller.navigationbar.barstyle = uibarstyleblackopaque; self.window.rootviewcontroller = self.navigationcontroller; [self.window makekeyandvisible]; return yes; } - (void)applicationwillresignactive:(uiapplication *)application { // sent when application move active inactive state. can occur types of temporary interruptions (such incoming phone call or sms message) or when user quits application , begins transition background state. // use method pause ongoing tasks, disable timers, , throttle down opengl es frame rates. games should use method pause game. } - (void)applicationdidenterbackground:(uiapplication *)application { // use method release shared resources, save user data, invalidate timers, , store enough application state information restore application current state in case terminated later. // if application supports background execution, method called instead of applicationwillterminate: when user quits. } - (void)applicationwillenterforeground:(uiapplication *)application { // called part of transition background inactive state; here can undo many of changes made on entering background. } - (void)applicationdidbecomeactive:(uiapplication *)application { // restart tasks paused (or not yet started) while application inactive. if application in background, optionally refresh user interface. } - (void)applicationwillterminate:(uiapplication *)application { // called when application terminate. save data if appropriate. see applicationdidenterbackground:. } @end same error (with selector inithwithnibname:bundle) in firstviewcontroller.m file
myviewcontroller* mycontroller = [[myviewcontroller alloc] initwithnibname:@"myviewcontroller" bundle:nil]; i don't know error means after googling it, , can't how fix it. in advance!
you should use different names variables , classes.
change:
firstviewcontroller *firstviewcontroller = [[firstviewcontroller alloc] initwithnibname:@"firstviewcontroller" bundle:nil]; to:
firstviewcontroller *firstviewcontroller = [[firstviewcontroller alloc] initwithnibname:@"firstviewcontroller" bundle:nil];
Comments
Post a Comment