0
おそらく間違いですが、ボタンを押した後にアプリがシャットダウンする理由を知る必要があります。それは1秒〜2秒の間、必要な答えを出してからシャットダウンします。どうして?一度メソッドを実行するとアプリケーションがクラッシュする
1{
2 @autoreleasepool {
3 return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
4 }
5}
3行目は緑色で網掛けされたと述べている:それはこれに私を取る「スレッド1:信号SIGBARTは」右側に。
これはコードです:
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
//dismiss the keyboard
[textField resignFirstResponder];
return YES;
}
@synthesize go;
@synthesize start;
@synthesize calc;
@synthesize answer;
@synthesize input;
@synthesize count;
- (void)updateTipTotals
{
int fuzzy = [input.text intValue];
//handle divide by 0
if (fuzzy %3 == 0 && fuzzy % 7 == 0) {
answer.text = @"Fuzzy Ducky";
}else {
if (fuzzy% 7 == 0) {
answer.text = @"Ducky";
}
else {
if (fuzzy % 3 == 0) {
answer.text = @"Fuzzy";
}else {
answer.text = input.text;
}
}
}
}
-(IBAction)calcTouchDown:(id)sender{
[self updateTipTotals];
}
- (void)viewDidLoad
{
[super viewDidLoad];
//this informs the text fields the controller is their delegate
input.delegate = self;
start.delegate = self;