Я следовал приведенному ниже уроку, он просто говорит вам создать кнопку и метку. При нажатии на кнопку метка должна измениться на какой-либо текст.
http://paulpeelen.com/2011/03/17/xcode-4-ios-4-3-hello-world/
Работает, но показывает пустой экран. Когда вы нажимаете на экран, он становится синим, как будто вся страница является кнопкой. Я думаю, что он загружает файл mainwindow.xib вместо стандартного ViewController.xib
Есть идеи, я явно что-то упускаю?
Спасибо
EDIT
#import <UIKit/UIKit.h>
@interface fun_buttonViewController : UIViewController {
UILabel *textLabel;
}
@property (nonatomic, retain) IBOutlet UILabel *textLabel;
- (IBAction)changeTheTextOfTheLabel;
@end
Реализация:
#import "fun_buttonViewController.h"
@implementation fun_buttonViewController
@synthesize textLabel;
- (void)dealloc
{
[super dealloc];
[textLabel release];
}
- (IBAction)changeTheTextOfTheLabel
{
[textLabel setText:@"Hello, World!"];
}
- (void)didReceiveMemoryWarning
{
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
#pragma mark - View lifecycle
/*
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
{
[super viewDidLoad];
}
*/
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
@end