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 8014855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:04:27+00:00 2026-06-04T20:04:27+00:00

I have an Xcode project and would like to switch view from one file,

  • 0

I have an Xcode project and would like to switch view from one file, file name is Score (without xib, it’s only Score.h and Score.m) to the main file (it’s name is View and does have a XIB) by using UIbutton in my file Score.m, but I can’t do that ..

Using this code :

UIButton *btn1 = [UIButton buttonWithType:UIButtonTypeCustom];
btn1.frame = CGRectMake(200, 400, img3.size.width/2, img3.size.height/2);
[btn1 setImage:img3 forState:UIControlStateNormal];
[btn1 setImage:img4 forState:UIControlStateDisabled];
[self addSubview:btn1];

if(btn1.selected) {
    View *second =[[View alloc] initWithNibName:nil bundle:nil];
    [self presentModalViewController:second animated:YES];
}

I get this error : Receiver type 'Score' for instance message doesn't declare a method with selector 'presentModalViewController : animated

Please help .

  • 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-04T20:04:29+00:00Added an answer on June 4, 2026 at 8:04 pm

    The error message you are receiving indicates, that Score (the class you are trying to push the new ViewController from) isn’t a ViewController.
    Only ViewControllers can present other Viewcontrollers. The Code for the presentation should be (placed in a ViewController):

    if(btn1.selected) {
        UIViewController *second =[[UIViewController alloc] initWithNibName:nil bundle:nil];
        [self presentModalViewController:second animated:YES];
        [second release]
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Xcode project with a few commits, and now I would like
I have been refraining from upgrading Xcode until one specific project is out of
I have folder that I would like to include in my Xcode project, but
I have an Xcode (4.3.2) project with the latest SDK which I would like
I have added a category to my Xcode project using File > New >
I would like to use the libical library in my project, but I have
I have two projects in an Xcode workspace. I would like to add the
I have an Xcode project with a large number of targets where I would
I need to access the data from my xcode project's full_settings.xcconfig file. I was
The following are the steps I would like to have: launch xcode open a

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.