Skip to content

Instantly share code, notes, and snippets.

@joaoportela
Created February 17, 2012 16:31
Show Gist options
  • Save joaoportela/1854249 to your computer and use it in GitHub Desktop.
Save joaoportela/1854249 to your computer and use it in GitHub Desktop.
layoutsubviews behaviour test (only most relevant part of the code)
// --------------- //
// VIEW CONTROLLER //
- (void)viewDidLoad
{
[super viewDidLoad];
JPMyView* view1 = [JPMyView viewWithName:@"view1"];
view1.backgroundColor = [UIColor greenColor];
view1.frame = CGRectMake(0.0f, 0.0f, 200.0f, 200.0f);
[self.view addSubview:view1];
self.view1_1 = [JPMyView viewWithName:@"view1.1"];
self.view1_1.backgroundColor = [UIColor blueColor];
self.view1_1.frame = [self bigRect];
[view1 addSubview:self.view1_1];
self.view1_1_1 = [JPMyView viewWithName:@"view1.1.1"];
self.view1_1_1.backgroundColor = [UIColor redColor];
self.view1_1_1.frame = [self mediumRect];
[self.view1_1 addSubview:self.view1_1_1];
}
- (IBAction)resizeView1_1:(id)sender;
{
NSLog(@"%@", NSStringFromSelector(_cmd));
if (CGRectEqualToRect(self.view1_1.frame, [self mediumRect])) {
self.view1_1.frame = [self bigRect];
} else {
self.view1_1.frame = [self mediumRect];
}
}
- (IBAction)resizeView1_1_1:(id)sender;
{
NSLog(@"%@", NSStringFromSelector(_cmd));
if (CGRectEqualToRect(self.view1_1_1.frame, [self smallRect])) {
self.view1_1_1.frame = [self mediumRect];
} else {
self.view1_1_1.frame = [self smallRect];
}
}
// ---------------- //
// JPMyView //
- (void)layoutSubviews;
{
[super layoutSubviews];
NSLog(@"%@ %@", self.name, NSStringFromSelector(_cmd));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment