Hi I am trying to write events for UI switch and UI segmentation control in UI collection view.
I declared the UIswitch and UIsegmentation control in collection view cell.
@interface CollectionViewCell : UICollectionViewCell
@property (strong, nonatomic) IBOutlet UISegmentedControl *mySegmentedControl;
@property (strong, nonatomic) IBOutlet UISwitch *Myswitch;
and access it from 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
{
}
}
But UI switch and segmentation control both not works for me. Any help will be appreciated.