私はiOSアプリの開発を学んでおり(Objective-CとCocoaのまったくの初心者です)、この非常に単純な例の演習を行っています(ラベルで左ボタンまたは右ボタンが押されていることを示す2つのボタン)。
IBOutletと数行のコード行を作成し、両方のAppViewControllerファイルを保存しましたが、インターフェイスビルダーでIBOutletを実際のラベルに接続しようとすると、アウトレットが表示されません。
iOSSDK4.3を使用しています
ソースコードは次のとおりです。
//
// BotonViewController.h
// Boton
//
// Created by Abu on 5/23/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface Hola_MundoViewController : UIViewController {
IBOutlet UILabel *statusText;
}
@property (retain, nonatomic) UILabel *statusText;
-(IBAction)buttonPressed: (id)sender;
@end
と
//
// BotonViewController.m
// Boton
//
// Created by Abu on 5/23/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import "BotonViewController.h"
@implementation Hola_MundoViewController
@synthesize statusText;
-(IBAction)buttonPressed: (id)sender
{
NSString *title = [sender titleForState:UIControlStateNormal];
NSString *newText = [[NSString alloc] initWithFormat:
@"%@ button pressed.", title];
statusText.text = newText;
[newText release];
}
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
- (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.
}
- (void)viewDidUnload {
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)dealloc {
[statusText release];
[super dealloc];
}
@end
さて、それはそれです、あなたがこれで私を助けることができることを願っています、おそらくばかげた間違いです、しかし私はたくさん閲覧しました、そして私は解決策を見つけることができません。