Ereignisse für UIswitch in der Sammlungsansicht schreiben
Hi Ich versuche, Ereignisse für den UI-Switch und die UI-Segmentierungssteuerung in der UI-Sammlungsansicht zu schreiben.
Ich habe das UIswitch- und UIsegmentation-Steuerelement in der Erfassungsansichtszelle deklariert.
@ interface CollectionViewCell: UICollectionViewCell
@property (strong, nonatomic) IBOutlet UISegmentedControl *mySegmentedControl;
@property (strong, nonatomic) IBOutlet UISwitch *Myswitch;
und greifen Sie darauf über view controller.m zu.
- (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
{
}
}
Aber UI-Schalter und Segmentierungssteuerung funktionieren bei mir beide nicht. Jede Hilfe wird geschätzt.