views:

55

answers:

0

I'm developing an application with a UINavigationBar which by default shows a particular view controller. There's a button in the nav bar that links to an outlet that pushes another xib using:

- (IBAction) settingsBtnClicked:(id)sender {
    SettingsViewController *settingsController = [[SettingsViewController alloc] initWithNibName:@"Settings" bundle:nil];
    settingsController.title = @"Settings";
    [self.navigationController pushViewController:settingsController animated:YES];
    [settingsController release];   
}

The issue I am having is this... In the main view controller, I have a view declared in the xib, but I programatically create a UIDatePicker and a UIPickerView that are added as subviews of the main views superview. When I click the 'settings' link, I can visually see my pickers slide to the upper left which the new view is sliding in. When I go back to my main view from the settings view, the frame coordinates on my subviews have been completely reset. I'm hoping I'm just missing something simple here... Here's an example of when I create one of the subviews:

    UIPickerView *p = [[UIPickerView alloc] initWithFrame:CGRectMake(0,416,320,216)];
    p.delegate = self; //will that work?
    p.showsSelectionIndicator = YES;    // note this is default to NO               
    self.categoryPickerView = p;        
    [self.view.superview addSubview:self.categoryPickerView];           
    [p release];