I am running this code, because I want to change something on all the buttons within my ViewController
when it starts.
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
int i = 1;
for (UIButton *btn in self.view.subviews)
{
NSLog(@"Count I - %d ", i);
//NSLog(@"Count I - %d - %@", i, btn.titleLabel.text);
i++;
}
}
The Output it:
2013-11-11 08:15:13.315 testingSingle[7876:a0b] Count I - 1
2013-11-11 08:15:13.317 testingSingle[7876:a0b] Count I - 2
Now this seems strange to me, because it is a new project and nothing has been dragged onto or even changed on the VC in the storyboard or in code - there is nothing to suggest that there 2 UIButton
s.
How can I get this message to return 0
if this is the case? My app crashes because of this.