У меня есть PromoCodeViewController, который запускается с использованием следующего кода:
@implementation Demo_WebServiceCallingUsingiOSAppDelegate
@synthesize window = _window,promoCodeController;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.promoCodeController = [[PromoCodeViewController alloc] init];
[self.window addSubview:self.promoCodeController.view];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
return YES;
}
PromoCodeViewController содержит UITextField, и я реализую UITextFieldDelegate для PromoCodeViewController, как показано:
@interface PromoCodeViewController : UIViewController<UITextFieldDelegate>
{
IBOutlet UITextField *promoCodeTextField;
}
@property (nonatomic,retain) IBOutlet UITextField *promoCodeTextField;
@end
* 1006реализовать метод textFieldShouldReturn, как показано:
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
return TRUE;
}
Я даже настроил PromoCodeViewController в качестве делегата для событий UITextField.Когда я начинаю печатать в TextBox, он выдает «Программа получила сигнал. EXC_BAD_ACCESS».Это происходит, когда я набираю второй символ в UITextField.Что я делаю не так?
ОБНОВЛЕНИЕ 1:
Ошибка появляется в следующем разделе:
int main(int argc, char *argv[])
{
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([Demo_WebServiceCallingUsingiOSAppDelegate class]));
}
}