I am a newbie in objective c;
I am getting an error at creating a UIAlertview instantiation statements (UIAlert * myAlert, they are in separate scopes)
I have referred the following stackoverflow entries such as This, this, this too and much more research over the internet.
I am unable to get a break through
Following are my alert calls
This is my view controller code where I have put up the "UIAlertViewDelegate"
#import <UIKit/UIKit.h>
@interface gameFirstViewController : UIViewController<UIAlertViewDelegate>
@end
This is my class declaration
#import <Foundation/Foundation.h>
@interface GameLogic : UIView
//all sorts of various non relevant property declarations
@end
Here is my implementation for the alerts
//action to take when an alert is shown
- (void)alertView:(UIAlertView *)alertView
didDismissWithButtonIndex:(NSInteger) buttonIndex
{ NSLog(@"OK Tapped");
NSUserDefaults *MySettingsData = [NSUserDefaults standardUserDefaults];
row= [MySettingsData integerForKey:@"Row_count"];
col = [MySettingsData integerForKey:@"Column_count"];
if(buttonIndex==0)
{
for(int i=0;i<row;++i)
{
for(int j=0;j<col;++j)
{
myarr[i][j]=0;
}
}
if(_TimerStatus ==1)
{
[mainTimer invalidate];
mainTimer=nil;
_TimerStatus=0;
}
[self super_reset];
[self setNeedsDisplay];
NSLog(@"Game reset");
return;
}
}
//my usage of the alerts at 2 different places
UIAlertView *myAlert = [[UIAlertView alloc]initWithTitle: @"GAME OVER"
message:@"You clicked on a mine, tap on ok to reset"
delegate:self
cancelButtonTitle:@"Ok"
otherButtonTitles:nil, nil];
[myAlert performSelectorOnMainThread:@selector(show)
withObject:nil
waitUntilDone:YES];
UIAlertView *myAlert = [[UIAlertView alloc]initWithTitle: @"You Won! Whoo Hoo"
message:@"You have successfully dodged every minefield"
delegate:self
cancelButtonTitle:@"Ok"
otherButtonTitles:nil, nil];
[myAlert performSelectorOnMainThread:@selector(show)
withObject:nil
waitUntilDone:YES];
I am not sure where I am going wrong, any help would be great!
Thanks.