views:

210

answers:

3

Hi all,

In my application, the view below navigation controller moves up and is visible below the navigation bar as it's becoming transperant after adding a barbuttonitem programmatically to the navigation controller which I'm adding to view through an xib.

This' the way I'm adding it:

UIBarButtonItem *comment = [[UIBarButtonItem alloc]
                            initWithBarButtonSystemItem:UIBarButtonSystemItemCompose
                            target:self
                            action:@selector(buttonPressed)];

self.navigationItem.rightBarButtonItem = comment;

EDIT:

Ok, I quite came to know that this' happening because for all my custom cells of different type except one, I'm pushing xib files of detailedviews to navigation controller for tapped cells, but for this only one, I've created a view controller programmatically and pushing it. So as long as I don't tap and open this cell in detailview, everything works fine, but after I open this cell's detailview(which always opens fine), other cells detailviews shift.

Can anybody please address this issue?

Thanx in advance.

A: 

Check all view's frame and for testing set different color for all subviews.You will find out the problem easily. or post more detailed code.

sandy
Views when pushed to navigation controller are at right position as long as this one created programmatically is not clicked. But after clicking this one, all others are shifting up except this one.
neha
if you still facing that problem than can you upload your code here ?
sandy
A: 

Difference in size of viewControllers view:

  1. If you are creating it through .XIB, then you will be having status bar in it. means your view size is 20 pixels lesser than that of the window. (320 * 460)

  2. If you are creating it programmatically, then there will not be a status bar. Means size will be 320*480.

In this way view frame differs...

So set the size of view to 320*460 and try out...

Manjunath
Thanx, Manjunath.. I'll try doing this and report you back..
neha
@neha: Does it work?
Manjunath
@Manjunath Thanx Manjunath for trying to help me.. But the problem turned out to be something else.. I have posted the answer..
neha
A: 

Ok, after lot of struggling, I figured it out that what causes the problem is that since I'm using Three20 library to show facebook-like photos, the TTPhotoviewcontorller in it changes the bar style of the navigation bar of your navigation controller to UIBarStyleBlackTranslucent, and what you need to do is to reset the bar style property to UIBarStyleDefault. You should try to call

self.navigationController.navigationBar.bar = UIBarStyleDefault;

neha
Are you sure that it will not give any problem? like while supporting orientation and all?
Manjunath
I'm yet to test it on iPhone.. But on simulator, it's working fine..
neha
Good job ... keep it
sandy