UIView is sized out of the blue
UIView is sized out of the blue
- Subject: UIView is sized out of the blue
- From: Alexander Reichstadt <email@hidden>
- Date: Mon, 02 Jan 2012 16:17:44 +0100
Hi,
when returning from my detail view the list view is sized out of the blue.
in viewDidAppear I do this:
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
if ([theSearchbar.text length]){
[theSearchbar becomeFirstResponder];
[self switchSearchbarInvisible:NO];
} else {
[theSearchbar resignFirstResponder];
[self switchSearchbarInvisible:YES];
}
}
In switchSearchbarInvisible: I do this:
- (void)switchSearchbarInvisible:(BOOL)isHidden
{
theSearchbar.hidden=isHidden;
CGRect tvbounds = [uiTableView bounds];
CGFloat ypos;
CGFloat yheight;
if (isHidden){
ypos = 0;
alphabetChoiceView.rowHeight=15.5;
} else {
ypos = 42;
alphabetChoiceView.rowHeight=14;
}
yheight = 406-ypos;
[uiTableView setFrame:CGRectMake(29,
ypos,
292,
yheight)];
tvbounds = [alphabetChoiceView bounds];
[alphabetChoiceView setFrame:CGRectMake(0,
ypos+2,
28,
yheight)];
if (!isHidden){
for (UIView *possibleButton in theSearchbar.subviews)
{
if ([possibleButton isKindOfClass:[UIButton class]])
{
UIButton *cancelButton = (UIButton*)possibleButton;
cancelButton.enabled = YES;
break;
}
}
}
[alphabetChoiceView setNeedsLayout];
[uiTableView setNeedsLayout];
[alphabetChoiceView setNeedsDisplay];
[alphabetChoiceView reloadData];
[self.view setNeedsLayout];
[self.view setNeedsDisplay];
}
Upon launching the app it works fine, so the via is correctly layouted. But once visiting the detail page it gets screwed up and the list view is pushed below the bottom toolbar. yheight is completely ignored.
As you can see I tried to refresh every contained view with everything I thought would make a change, but it seems that this all gets ignored. My question is how to make CocoaTouch stop ignoring my changes? I tried to have this called in viewDidLoad, viewWillLoad, viewWillAppear, viewDidAppear to no avail?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden