Need help with combo


#1

hey guys

I’ve been developing an app for iPhone here’s the thing

I have a viewController with a tableview and at the bottom I’ve added a view with a toolbar with a button inside of it and a pickerView

the view with toolbar and pickerview is hidden when the window appears, and there are several buttons which makes visible the view below of certain textboxes, like a combobox

but if a tableview section has a header, when I invoque the view this bug appears…

tableview header overlaps the view with the pickerview, and in such area is not possible to move or press anything, kind of annoying

thanks in advace for your help

I’ll post my code below for reference

//This method is an example of a button invoquing the UIView with toolbar and pickerview inside in certain location
- (IBAction)verComboTipoVisitaButton:(id)sender {
    //Verificar que tamaño de pantalla tiene el dispositivo antes de desplegar el combo
    [self VerificarTamanoPantalla];
    
    //Llenar el combo con los datos y mostrarlo
    [self llenaPickerView:_myPickerView arregloDatos:arrayTipoVisita campoTextoDestino:@"TipoVisita"];
    [self muestraPickerView:self.comboViewController coordForX:coordXCombobox coordForY:coordYCombobox+870
                      width:anchoCombobox height:altoCombobox];    
}


//this method verifies screen orientation for displaying the correct height of view with pickerview
-(void)VerificarTamanoPantalla{
    //Horizontal Screen
    if ([[UIDevice currentDevice] orientation] == 2 ||
        [[UIDevice currentDevice] orientation] == 3 ||
        [[UIDevice currentDevice] orientation] == 4)
        anchoCombobox = screenHeight;
    
    //Vertical Screen
    else if([[UIDevice currentDevice] orientation] == 0 ||
            [[UIDevice currentDevice] orientation] == 1)
        anchoCombobox   = screenWidth;
}

//Fills pickerview with content of certain array, depending the field we're selecting
-(void)llenaPickerView:(UIPickerView *)pickerView arregloDatos:(NSArray *)arregloDatos campoTextoDestino:(NSString *)campoTextoDestino{
    
    campoTexto = campoTextoDestino;
    arrayData = [NSMutableArray arrayWithArray:arregloDatos];
    [pickerView reloadAllComponents];
}




//This one is for showing on screen the view with pickerview
-(void)muestraPickerView:(UIView *)vista coordForX:(NSInteger)coordForX coordForY:(NSInteger)coordForY width:(NSInteger)width height:(NSInteger)height{
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:0.3];
    
    vista.frame = CGRectMake(coordForX, coordForY, width, height);
    [UIView commitAnimations];
    vista.hidden = FALSE;
}

#2

a simple line of code helped me to solve this issue

[self.view bringSubviewToFront:vista];

added at the end of this function

-(void)muestraPickerView:(UIView *)vista coordForX:(NSInteger)coordForX coordForY:(NSInteger)coordForY width:(NSInteger)width height:(NSInteger)height{

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3];

vista.frame = CGRectMake(coordForX, coordForY, width, height);
[UIView commitAnimations];
vista.hidden = FALSE;
[self.view bringSubviewToFront:vista];

}