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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:55:41+00:00 2026-06-10T06:55:41+00:00

I’m a noob to iOS development (so please bear with me on this), and

  • 0

I’m a noob to iOS development (so please bear with me on this), and I’m trying to create a simple touch application with Xcode from scratch. I have spent a week on this, but I couldn’t seem to find out what I have been missing so here I am, asking for some guidance 🙂

First, I created an empty application, then created a xib file (MainWindow.xib) and added a window object (Main_Window) to it. Then, I created a View object (Main_View) within this Main_Window, and added a label object (lblTitle) to this view. The Main_View object pretty much covered the entire Main_Window screen.

So, in short, the hierarchy of my MainWindow.xib is like this: Main_Window –> Main_View –> lblTitle.

Finally, I created a ViewController object (Main_View_Controller) with its “view” set to Main_View and its “rootViewController” set to “Main_Window”.

In the project,

I subclassed UIView with “TouchEvent_View”, hooked up to “Main_View” in the xib file.

I subclassed UIViewController with “TouchEvent_ViewController”, hooked up to “Main_View_Controller” in the xib file.

In my AppDelegate.h,

I created an “IBOutlet UIWindow *window”, hooked up to “Main_Window” in the xib file.

I created an object for my viewController and view classes.

 @property (strong, nonatomic) IBOutlet UIWindow *window; 
 @property (strong, nonatomic) TouchEvent_ViewController * myViewController;
 @property (strong, nonatomic) TouchEvent_View *myView;

In AppDelegate.m, I hooked up “MainWindow.xib” with myViewController:

 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{ 
    self.window.backgroundColor = [UIColor whiteColor];

    self.myViewController = [[[TouchEvent_ViewController alloc]
                          initWithNibName:@"MainWindow" bundle:nil] autorelease];

    [self.window makeKeyAndVisible];



    return YES;
}

In “Touch_Event_ViewController.m”, I coded the viewDidLoad message as followed:

- (void)viewDidLoad
{
 [super viewDidLoad];
  NSLog(@"Hi! ViewController's viewDidLoad msg sent!");

  TouchEvent_View * mView = [[TouchEvent_View alloc] initWithFrame:CGRectMake(0, 0, 300, 300)];
  mView.backgroundColor = [UIColor blueColor];
  [self.view addSubview:mView];
  [mView release];

}

In “TouchEvent_View.m”, I instantiated a UITapGestureRecognizer object and hooked it up to a handler method as followed:

- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {

    NSLog(@"[TouchEvent_View initWithFrame] sent!");

    // Initialization code

    //-----------------------
    //Touch event declaration

    //Single tap
    UITapGestureRecognizer * singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(SingleTap_Handler)];

    singleTap.numberOfTapsRequired = 1;
    singleTap.numberOfTouchesRequired = 1;
    //singleTap.delegate = self;

    [self addGestureRecognizer:singleTap];

}
return self;
}


-(void) SingleTap_Handler :(UITapGestureRecognizer *)GR
{
    NSLog(@"Hi! You just touched the screen!");

}

When I compiled and deployed the project into my iPad3, every thing worked just as planned until the Touch event, which didn’t work.

I got the following messages printed out to the console window:

2012-08-26 14:03:59.589 Ex_TouchEvents_01[806:707] Hi! ViewController's viewDidLoad msg sent!
2012-08-26 14:03:59.593 Ex_TouchEvents_01[806:707] [TouchEvent_View initWithFram] sent!

But I did not see the “Hi, you just touched the screen!” message after I touched the screen. In addition, I didn’t see the background of the View area set to blue either. So, I must have been missing something that was very simple. I have been googling all over the web, but I couldn’t figure out what I missed. Would some body kindly point out what I have done wrong?

  • 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-10T06:55:42+00:00Added an answer on June 10, 2026 at 6:55 am

    I don’t have access to my Mac to test this, but I believe you’re missing a colon in this line.

    UITapGestureRecognizer * singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(SingleTap_Handler)];
    

    It needs to be:

    UITapGestureRecognizer * singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(SingleTap_Handler:)];
    

    If a method takes any parameters, the colon(s) are part of the selector.

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

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to create an if statement in PHP that prevents a single post
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I am trying to understand how to use SyndicationItem to display feed which is

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.