Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8402335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:01:40+00:00 2026-06-09T22:01:40+00:00

-(void)checkCollision{ if (CGRectIntersectsRect(player.frame, enemy.frame)) { [randomMain invalidate]; [start setHidden:NO]; CGRect frame = [player frame];

  • 0
-(void)checkCollision{
if (CGRectIntersectsRect(player.frame, enemy.frame)) {

    [randomMain invalidate];
    [start setHidden:NO];

    CGRect frame = [player frame];
    frame.origin.x = 137.0f;
    frame.origin.y = 326.0;
    [player setFrame:frame];

    CGRect frame2 = [enemy frame];
    frame2.origin.x = 137.0f;
    frame2.origin.y = 20.0;
    [enemy setFrame:frame2];


    [randomMain invalidate];
    [start setHidden:NO];

    [timer invalidate];
    time.text = @"0";

Hello There, the problem I am facing is that I try and make an alert view below yet i get an error saying the following: Invalid argument type “void” to unary expression. on the line reading: -(void) alert1:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)ButtonIndex {
Cheers

    time.text = @"0"; 
    [timer invalidate];




          NSString *timemessage = [NSString stringWithFormat:@"Unlucky! You survived for %i seconds!", timenumber];
              UIAlertView *alert1 = [[UIAlertView alloc] initWithTitle:@"You've Been Caught!" message:timemessage delegate:nil cancelButtonTitle:@"Try Again" otherButtonTitles:@"Show Leaderboard", @"Submit To game Center",nil];
    [alert1 show];




              -(void) alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)ButtonIndex {
        if (ButtonIndex == 1) {
        GKScore *myScore = [[GKScore alloc]
                            initWithCategory:@"*****"];
            myScore.value = timenumber;



        }
        }










                }}
            ;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T22:01:42+00:00Added an answer on June 9, 2026 at 10:01 pm

    The line -(void) alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)ButtonIndex { is a start of a new method. It can’t be enclosed inside checkCollision. You need to move it and all of its code outside. It can go right after the end of checkCollision if you want. You also need to set the delegate of the UIAlertView to the object you want to receive the alertView:clickedButtonAtIndex: callback. Usually that is self. Something like this:

    -(void)checkCollision {
        // Blah, blah, ....
        NSString *timemessage = [NSString stringWithFormat:@"Unlucky! You survived for %i seconds!", timenumber];
        UIAlertView *alert1 = [[UIAlertView alloc] initWithTitle:@"You've Been Caught!" message:timemessage delegate:self cancelButtonTitle:@"Try Again" otherButtonTitles:@"Show Leaderboard", @"Submit To game Center",nil];
        [alert1 show];
    }
    
    -(void) alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)ButtonIndex {
        if (ButtonIndex == 1) {
            GKScore *myScore = [[GKScore alloc] initWithCategory:@"*****"];
            myScore.value = timenumber;
        }
        // Handle other button choices ....
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I am stumped. Here is my collision check method` public void checkCollision ()
- (void)drawRect:(CGRect)rect { // Drawing code. stickerImage = [UIImage imageNamed:@betaImage.png]; CGSize size = stickerImage.size;
- (void)viewDidLoad{ [super viewDidLoad]; NSString *path = [[NSBundle mainBundle] pathForResource:@VidName ofType:@mov]; NSURL *url =
void test() { unsigned char c; c = (~0)>>1 ; printf(c is %u\n,c); }
- (void)TargetHit:(int)target{ void (^threadBlock)(void) = ^{ NSLog(@respond to selector %d, [self respondsToSelector:@selector(changeImageOfTarget:)]); [[NSOperationQueue mainQueue]
- (void)connectionDidFinishLoading:(NSURLConnection *)connection { self.listFeedConnection = nil; // release our connection [UIApplication sharedApplication].networkActivityIndicatorVisible =
- (void)fadeOutSplash { UIImageView *splash = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@Default-Landscape~ipad.png]]; [self.window.rootViewController.view addSubview:splash]; // <--
void SaveFiles(out XElement Attachments) { Attachments = null; if (Uploader1.UploadedFiles.Count() > 0) { Attachments
- (void)application:(UIApplication *)app didReceiveLocalNotification:(UILocalNotification *)notif { // Handle the notificaton when the app is
void foo(Node* p[], int size){ _uint64 arr_of_values[_MAX_THREADS]; for (int i=0 ; i < size

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.