2011-05-26 6 views

Respuesta

3

pickerView.showsSelectionIndicator = NO;

0

Sólo hay que establecer la propiedad UITableViewCell selectionStyle a UITableViewCellEditingStyleNone

cell.selectionStyle = UITableViewCellEditingStyleNone; 
+0

es un pickerview, no una tabla vista. ¿Funcionará de todos modos? –

+0

Lo sentimos, rocíe la parte pickerview, eche un vistazo a este hilo: http://stackoverflow.com/questions/958443/overriding-highlighted-selection-in-uipickerview – rckoenes

+0

lo probé ... no pude hacerlo funcionar . (la segunda respuesta) –

0

tengo añadir la barra de herramientas en la parte superior de vista selector y añadir el botón cutom como una vista sub de barra de herramientas y tanto en la vista selector y la barra de herramientas se añada como un subvista de la vista principal para que pueda manejar esto.

+0

¿Puede explicarlo con más detalle? realmente no entiendo –

0

Me he encontrado con este. Echemos un vistazo en detalles. Para crear su vista personalizada de selector, cree su clase UIView personalizada, p. :

@interface TimeAroundView : UIView 
{ 
    NSString *title; 
    UIImage *image; 
} 
@property (nonatomic, retain) NSString *title; 
@property (nonatomic, retain) UIImage *image; 
@end 

Luego, en su controlador de vista de selector personalizado crea un contenedor, p. NSArray, que obtendrá todos los objetos TimeAroundView que desee representar en su vista del seleccionador. Así, para cada objeto que debe hacer

timeAroundViewObject.userInteractionEnabled = NO; 

Creo - (id) init es el mejor lugar para llenar dicho contenedor en, por lo que obtener algo como esto:

- (id)init 
{ 
    self = [super init]; 
    if (self) { 
     // create the data source for this custom picker 
     NSMutableArray *viewArray = [[NSMutableArray alloc] init]; 

     TimeAroundView *earlyMorningView = [[TimeAroundView alloc] initWithFrame:CGRectZero]; 
     earlyMorningView.title = @"Early Morning"; 
     earlyMorningView.image = [UIImage imageNamed:@"12-6AM.png"]; 
     earlyMorningView.userInteractionEnabled = NO; 
     [viewArray addObject:earlyMorningView]; 
     [earlyMorningView release]; 

     TimeAroundView *lateMorningView = [[TimeAroundView alloc] initWithFrame:CGRectZero]; 
     lateMorningView.title = @"Late Morning"; 
     lateMorningView.image = [UIImage imageNamed:@"6-12AM.png"]; 
     lateMorningView.userInteractionEnabled = NO; 
     [viewArray addObject:lateMorningView]; 
     [lateMorningView release]; 

     // .... (more of objects) 

     self.customPickerArray = viewArray; 
     [viewArray release]; 
    } 

    return self; 
} 

Y en su pickerView : viewForRow: forComponent: reusingView: acaba de devolver el elemento adecuado de la matriz. Eso funciona para mí.

Cuestiones relacionadas