escribir eventos para UIswitch en la vista de colección
Hola, estoy tratando de escribir eventos para el interruptor de interfaz de usuario y el control de segmentación de la interfaz de usuario en la vista de colección de interfaz de usuario.
Declaré el control UIswitch y UIsegmentation en la celda de vista de colección.
@interface CollectionViewCell: UICollectionViewCell
@property (strong, nonatomic) IBOutlet UISegmentedControl *mySegmentedControl;
@property (strong, nonatomic) IBOutlet UISwitch *Myswitch;
y acceder desde view controller.m
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
CollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"CELL" forIndexPath:indexPath];
if(cell.Myswitch.isOn)
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"!Alert"
message:@"Do you want to exit the application?"
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"Yes", nil];
[alert show];
}
else
{
}
}
Pero el interruptor de UI y el control de segmentación no funcionan para mí. Cualquier ayuda será apreciada.