我按照下面的教程,它基本上只是告訴你創建一個按鈕和一個標籤。當你點擊按鈕時,標籤應該變成一些文字。基本xcode iPhone應用程序不工作,按鈕點擊更改文本?
http://paulpeelen.com/2011/03/17/xcode-4-ios-4-3-hello-world/
它運行,但它顯示了一個空白屏幕。當你點擊屏幕時,它會變成藍色,就像整個頁面是一個按鈕。我認爲這是加載mainwindow.xib文件,而不是默認ViewController.xib
任何想法,我明顯缺少什麼?
感謝
編輯
#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
:)...它總是很簡單。我昨天沮喪地甩掉了我的頭髮。感謝您花時間下載並查看源代碼。輝煌。謝謝。 :) – Mantisimo