Я учусь разрабатывать приложения для iOS (я новичок в Objective-C и Cocoa), и я делаю это очень простое примерное упражнение (две кнопки, которые показывают, что кнопка «Влево» или «Вправо» нажата в метке).
Я просто создаю IBOutlet и пару строк кода, сохраняю оба файла AppViewController, и при попытке подключить IBOutlet с фактической меткой в Интерфейсном Разработчике розетка не отображается.
Я использую iOS SDK 4.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
Ну, вот и все, надеюсь, вы поможете мне с этим, возможно, это глупая ошибка, но я много просмотрел и не могу найти решение.