The application will stop responding to any touch events after clicking on either button. (Controller#increase / Controller#decrease methods).
Here is the output of the console on startup
[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)
Running the application on debug mode I see that there is indeed a call on the corresponding method as well as updating the UI. So the method does reach to the end of it and returns.
2009-10-04 14:42:25.723 HelloPoly[1340:207] sides increased to 6
However removing the call
[self updateInterface];
the application behaves normally (e.g. touch events are handled) but of course not according to specification :).
Program code follows
//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