I am just trying to write my very first code in Objective C.
I have created a new project in XCode and added the following lines of code:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
UILabel *myMessage;
myMessage=[[UILabel alloc] initWithFrame:CGRectMake(190, 300, 500, 75)];
myMessage.text=@"Hello World!";
myMessage.font=[UIFont systemFontOfSize:72];
[window addSubView:myMessage];
[myMessage release];
[window makeKeyAndVisible];
return YES;
}
However, I got the following warning (on line [window addSubView:myMessage]):
warning: ‘UIWindow’ may not respond to ‘-addSubView:’
And when I launch the application, it just terminates.
Though I just copied the code from the book “Sams Teach Yourself iPad Development”, and it seems that it should show a message on the screen.
Any help would be appreciated.
Thank you.
get rid of the capital V. it should be