tags:

views:

953

answers:

2

Hello, in my app i have a tabBarController and in it a navigationController. One of my view controllers is a TableViewController and under the navigationBar i added a uiView as a subview to the view like this:

rectangleInfo = [[UIView alloc] initWithFrame:CGRectMake(0,0,[[UIScreen mainScreen] applicationFrame].size.width,26)]; rectangleInfo.autoresizingMask = (UIViewAutoresizingFlexibleWidth); rectangleInfo.backgroundColor = [UIColor darkGrayColor]; [self.view addSubview: rectangleInfo];

when i click on a cell in the tableView i push an UIViewController like this:

[feedViewController setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];

[[self navigationController] presentModalViewController:feedViewController animated:YES];

After i pop the modal view for a couple of times with it from the tableViewNavigationController dissapers the rectangleInfo UIView.

i pop my modalview like this:

[[UIApplication sharedApplication] setStatusBarHidden:NO animated:YES];
[self setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
[self dismissModalViewControllerAnimated:YES];

any idea why that subview (rectangleInfo) of the tableViewController dissapears after i remove the modal view from the superview?

thank you in advance.

A: 

I'm curious as to what you are trying to do with your rectangleInfo view? By the size of it, it looks like you are trying to mimic the status bar. Why? You can just hide the status bar if you want.

Another thing you can try is to create the UIView visually in Interface Builder. Don't actually add it to your main view, but create it as a separate UIView in the XIB with the appropriate size, etc. Then create an outlet for it in Xcode and connect it. Next, add it as a subview in code when your view controller loads. See if that makes a difference. This is especially strange since you say it only disappears after popping it several times. Do you get the same problem if you push and pop the non-modal way, e.g.:

[[self navigationController] pushViewController:feedViewController animated:YES];
[[self navigationController] popViewControllerAnimated:YES];
Matt Long
Hello Matt, with the rectangleInfo view i'm not trying to mimic the status bar. this picture shows better what i'm trying to do with that view http://img269.imageshack.us/img269/9001/picture1wim.png. Under the NavigationBar is the rectangleInfo that has a UILabel on it that displays the current category. i'll try what you suggested and i'll return with the feedback. thank you
SorinA.
hello Matt, i tried what you suggested. the problem still appears and also because i have an tabbar my feedViewController doesn't appear over it. if i try to hide it, the space that was occupied by the tab bar can't be used by my view..
SorinA.
hmm i tested my app again and i found out that my subview is dissapearing because i receive a memory warning. The os is releasing any views that are not visible..curious is the fact that it doesn't rebuild the rectangleInfo subview but the others are set again after the memory warning...
SorinA.
A: 

i solved the problem by implementing correctly the viewDidLoad and viewDidUnload methods for creating and releasing my subviews.

SorinA.