Skip to content

Instantly share code, notes, and snippets.

@spraveenk91
Last active August 29, 2015 14:08
Show Gist options
  • Save spraveenk91/e94a1970c6550d04414e to your computer and use it in GitHub Desktop.
Save spraveenk91/e94a1970c6550d04414e to your computer and use it in GitHub Desktop.
FirstViewController Main File
//
// FirstViewController.m
//
// Created by Work on 19/09/14.
// Copyright (c) 2014 App. All rights reserved.
//
#import "FirstViewController.h"
@interface FirstViewController () <BaseDelegate> // Delegate
@end
@implementation FirstViewController {
NSMutableArray *moviesRecords, *topHeaderRecords;
UIActionSheet *menuActionSheet, *thumbActionSheet, *shareActionSheet;
NSTimer *carouselTimer;
NSInteger pageIndex;
}
#pragma mark - Actions
/**
* Method invoke by CollectionView cell click
*/
- (void)cellMenuClicked:(id)sender {
// UIButton *button = (UIButton *)sender; Use this later
thumbActionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Add to Watchlist", @"Share", nil];
[thumbActionSheet showInView:[self.view window]];
}
#pragma mark - BaseViewController Delegate
- (void)didSelectActionSheetIndex:(NSString *)actionTitle actionSheetIndex:(NSInteger)index {
NSLog(@"Text - %@", actionTitle);
}
...
...
...
#pragma mark - UIActionSheet Delegate
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
/* if (actionSheet == menuActionSheet) {
switch (buttonIndex) {
case 0: {
[self performSegueWithIdentifier:@"allmoviesSegue" sender:nil];
}
break;
case 1: {
}
break;
case 2: {
[self performSegueWithIdentifier:@"filterSegue" sender:nil];
}
break;
default:
break;
}
} else */ if (actionSheet == thumbActionSheet) {
switch (buttonIndex) {
case 0: {
}
break;
case 1: {
shareActionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"FACEBOOK", @"TWITTER", @"GOOGLE PLUG", @"PINTEREST", nil];
[shareActionSheet showInView:[self.view window]];
}
break;
default:
break;
}
} else if (actionSheet == shareActionSheet) {
switch (buttonIndex) {
case 0: {
}
break;
case 1: {
}
break;
default:
break;
}
}
}
...
...
...
#pragma mark - View Lifecycle
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a
// Initialize Delegate
self.delegate = self;
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
...
...
...
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment