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

  • Home
  • SEARCH
  • 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 7709547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:53:25+00:00 2026-06-01T00:53:25+00:00

I have a scrollview in which i am creating buttons programmatically. On touch, button

  • 0

I have a scrollview in which i am creating buttons programmatically. On touch, button is supposed to load another nib. The problem is, on touch, i am getting
[ViewController buttonTest]: unrecognized selector sent to instance

Let me take you through the code:

appdelegate.h

@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) UINavigationController *viewController;

appdelegate.m

#import "ViewController.h"
@implementation AppDelegate 
@synthesize window = _window;
@synthesize viewController = _viewController;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

    ViewController *view = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
    self.viewController = [[UINavigationController alloc] initWithRootViewController:view];
    self.window.rootViewController = self.viewController;
    [application setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];
    [self.window makeKeyAndVisible];
    return YES;
}

Viewcontroller.h

@class newView;

@interface ViewController : UIViewController{

    UIScrollView * scrollView;
    IBOutlet UIButton *btn;

}

- (IBAction)butttonTest:(id)sender;
    @property (strong, nonatomic) newView *secondView;

and finally, ViewController.m

- (void)loadView {

    CGRect fullScreenRect=[[UIScreen mainScreen] applicationFrame];
    scrollView=[[UIScrollView alloc] initWithFrame:fullScreenRect];
    scrollView.contentSize=CGSizeMake(320,960);
    UIImageView *tempImageView2 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"image.jpeg"]];

    UIImage * buttonImage = [UIImage imageNamed:@"contentlist_active.png"];

    self.view=scrollView;
    [scrollView addSubview:tempImageView2];
    scrollView.userInteractionEnabled = YES;
    btn = [UIButton buttonWithType:UIButtonTypeCustom];
    btn.frame = CGRectMake(22, 100, 277, 32);
    [btn setBackgroundImage:buttonImage forState:UIControlStateNormal];
    [btn setTitle:@"hello world" forState:UIControlStateNormal];
    [btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];

    [btn addTarget:self action:@selector(buttonTest:) forControlEvents:UIControlEventTouchUpInside];

    [scrollView addSubview:btn];

}

To load the view, I have code:

[btn addTarget:self action:@selector(buttonTest) forControlEvents:UIControlEventTouchUpInside];

What am i doing wrong?

OH yes, here is the method for buttenPressed

- (IBAction)butttonTest:(id)sender {
self.secondView = [[newView alloc] initWithNibName:@"newView" bundle:nil];

[self.navigationController pushViewController:self.secondView animated:YES];

}
  • 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-01T00:53:26+00:00Added an answer on June 1, 2026 at 12:53 am

    your method is called - (IBAction)butttonTest:(id)sender.
    Three t and a parameter.

    But your selector is @selector(buttonTest). Two t and no parameter.

    The two method signatures just don’t match.

    change the addTarget:action:forControlEvents: call like this:

    [btn addTarget:self action:@selector(butttonTest:) forControlEvents:UIControlEventTouchUpInside];
    

    or remove the third t on both.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have ScrollView which contains 10 buttons. When a activity is launched only first
i am supposed to load large number of images on to a scrollview which,
I have a scrollview which has to display a view larger than the available
I have an app which contains a scrollview with several tableviews. Each tableview is
I have built a table which is basically done by HorizontalScrollView inside a ScrollView
I have a UIScrollView which I create and size dynamically using... scrollView.contentSize = CGSizeMake(scrollView.frame.size.width
I have a horizontal scrollView which contains 2 images.The scrollView is circular.What I want
I have an infinite scrollview in which I add images as the user scrolls.
I have a ScrollView that contains a complex LinearLayout with various elements, among which
I have a scrollView that I'd like to programmatically move based on the delta

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.