add dismiss popover delegate

Send Snippet To: Save this snippet to Code Collector Pro -- view all balzan's snippets
language: Objective-C
license: Other

Code for Snippet:

                
//in view controller that is being popped
 
.h
#import "popOverProtocol.h"
 
@property (weak, nonatomic) id<popOverProtocol> delegate;
 
 
.m
 
 
-(void) viewDidAppear:(BOOL)animated{
	[super viewDidAppear:animated];
	if ([kSettingsFreeVersion isEqualToString:@"YES"]) {
		UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"Free Version Limit" message:@"This Screen is only avalible in the Full Version. When you Purchase TV Tracker you will be able to access all sections of this app" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Purchase", @"Learn More", nil];
		[alert show];
	}
 
}
 
 
 
#pragma mark - UIAlerViewDelgate
 
 
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
	if ([alertView.title isEqualToString:@"Free Version Limit"]){
		if(buttonIndex == alertView.cancelButtonIndex){
			[self doneBarButtonTouched:nil];
			[Flurry logEvent:@"ActorViewController:Free Version Limit:Cancel"];
 
		}
		else if (buttonIndex == 1){
			[[UIApplication sharedApplication] openURL:[NSURL URLWithString: kApplicationStoreURL]];
			[self doneBarButtonTouched:nil];
			[Flurry logEvent:@"ActorViewController:Free Version Limit:Purchase"];
 
		}
		else if (buttonIndex == 2){
			UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"More Info" message:@"In this screen you can see some of the previous shows and roles that this actor was in. As well as search for the actor on IMDB, Wikipedia and the internet" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:@"Purchase", nil];
			[alert show];
			[Flurry logEvent:@"ActorViewController:Free Version Limit:MoreInfo"];
 
		}
	}
	else if ([alertView.title isEqualToString:@"More Info"]){
		if(buttonIndex == alertView.cancelButtonIndex){
			[self doneBarButtonTouched:nil];
			[Flurry logEvent:@"ActorViewController:MoreInfo:Cancel"];
 
		}
		else if (buttonIndex == 1){
			[[UIApplication sharedApplication] openURL:[NSURL URLWithString: kApplicationStoreURL]];
			[self doneBarButtonTouched:nil];
			[Flurry logEvent:@"ActorViewController:MoreInfo:Purchase"];
		}
	}
}
 
 
 
 
- (IBAction)doneBarButtonTouched:(id)sender {
	[self.delegate dismissViewController];
 
}
 
 
 
 
// in the calling view controller
 
// in prepare for segue  	viewController.delegate = self;
 
 
comments powered by Disqus

Info

Link to this snippet:


Download to Code Collector

To use the direct link to your snippet on CodeCollector.net either copy the html from the above section or drag the Download to Code Collector to where you would like to use it.

More Info:

Times Viewed: 334
Date Added: 2012-12-17 10:32:21
Last Modified: 2014-02-18 20:29:30

Web Analytics