Приложение перестанет реагировать на любые сенсорные события после нажатия на любую кнопку. (Controller # увеличение / Controller # уменьшение методы).
Вот вывод консоли при запуске
[Session started at 2009-10-04 14:41:20 +0300.]
GNU gdb 6.3.50-20050815 (Apple version gdb-1344) (Fri Jul 3 01:19:56 UTC 2009)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin".sharedlibrary apply-load-rules all
Attaching to process 1340.
Pending breakpoint 1 - ""Controller.m":46" resolved
2009-10-04 14:41:23.339 HelloPoly[1340:207] My polygon: Hello I am a 5-sided polygon (aka a Pentagon) with angles of 108 degrees (1.884956 radians).
(gdb)
Запуск приложения в режиме отладки. Я вижу, что действительно вызов соответствующего метода, а также обновление пользовательского интерфейса. Таким образом, метод достигает конца и возвращает.
2009-10-04 14:42:25.723 HelloPoly[1340:207] sides increased to 6
Однако удаление вызова
[self updateInterface];
приложение ведет себя нормально (например, обрабатываются сенсорные события), но, конечно, не в соответствии со спецификацией:).
Код программы следует
//Controller extends NSObject
#import "Controller.h"
@implementation Controller
- (void)awakeFromNib { // configure your polygon here
polygon.minimumNumberOfSides = 3;
polygon.maximumNumberOfSides = 12;
polygon.numberOfSides = numberOfSidesLabel.text.integerValue;
NSLog (@"My polygon: %@", polygon);
}
- (void)updateDecreaseButton{
decreaseButton.enabled = [polygon hasMinimumSides];
}
- (void)updateIncreaseButton{
increaseButton.enabled = [polygon hasMaximumSides];
}
- (void)updateNumberOfSidesLabel{
numberOfSidesLabel.text = [NSString stringWithFormat:@"%i", polygon.numberOfSides];
}
- (void)updateInterface {
[self updateDecreaseButton];
[self updateIncreaseButton];
[self updateNumberOfSidesLabel];
}
- (IBAction)decrease:(id)sender {
NSLog(@"sides decreased to %i", [polygon decreaseSides]);
[self updateInterface];
}
- (IBAction)increase:(id)sender {
NSLog(@"sides increased to %i", [polygon increaseSides]);
[self updateInterface];
}
@end