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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:37:30+00:00 2026-05-13T09:37:30+00:00

I have a really simple app, and I’m stuck just in the beginning. Let

  • 0

I have a really simple app, and I’m stuck just in the beginning.
Let me post the code right here.

TapStackView.h

#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>

@interface TapStackView : UIView
{
    //Layers.
    UIImageView *backgroundImageView;
    UIImageView *powerOn;
}
@property (nonatomic, retain) UIImageView *backgroundImageView;
@property (nonatomic, retain) UIImageView *powerOn;
@end

TapStackView.m

#import "TapStackView.h"

@implementation TapStackView
@synthesize backgroundImageView, powerOn;

//Initialize,
-(id)initWithFrame: (CGRect)frame
{
    if (self = [super initWithFrame:frame])
    {
        //Set up layers.
        self.backgroundImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"layout.png"]];

        self.powerOn = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"powerOn.png"]];     
        self.powerOn.center = CGPointMake(159 + powerOn.frame.size.width/2, 26 + powerOn.frame.size.height/2);

        //Attach to the view.
        [self addSubview:self.backgroundImageView];
        [self addSubview:powerOn];      

        NSLog(@"initWithFrame - powerOn.center is %f, %f", self.powerOn.center.x, self.powerOn.center.y);   

    }
    return self;
}

//Finger touched.
-(void)touchesBegan: (NSSet*)touches withEvent: (UIEvent*)event
{
    NSLog(@"-----");
    NSLog(@"touchesBegan - self.powerOn.center is %f, %f", self.powerOn.center.x, self.powerOn.center.y);   
}

@end

Console

[Session started at 2010-01-01 21:39:42 +0100.]
2010-01-01 21:39:44.177 TapStack[6261:20b] initWithFrame - powerOn.center is 186.000000, 53.000000
2010-01-01 21:39:45.149 TapStack[6261:20b] -----
2010-01-01 21:39:45.150 TapStack[6261:20b] touchesBegan - self.powerOn.center is 0.000000, 0.000000
2010-01-01 21:39:45.978 TapStack[6261:20b] -----
2010-01-01 21:39:45.979 TapStack[6261:20b] touchesBegan - self.powerOn.center is 0.000000, 0.000000
2010-01-01 21:39:48.914 TapStack[6261:20b] -----
2010-01-01 21:39:48.915 TapStack[6261:20b] touchesBegan - self.powerOn.center is 0.000000, 0.000000
2010-01-01 21:39:50.011 TapStack[6261:20b] -----
2010-01-01 21:39:50.012 TapStack[6261:20b] touchesBegan - self.powerOn.center is 0.000000, 0.000000

I just cannot imagine why can’t I see that powerOn property inside the touchesBegan method.
Any ideas?

  • 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-05-13T09:37:31+00:00Added an answer on May 13, 2026 at 9:37 am

    I can’t reproduce this. How are you adding TapStackView to its superview? From a Window-based template, I just added this to applicationDidFinishLaunching:

        [window addSubview:[[[TapStackView alloc] initWithFrame:[window bounds]] autorelease]];
    

    It seems to work as you would expect:

    2010-01-01 17:23:00.873 Untitled[3708:207] initWithFrame - powerOn.center is 215.000000, 90.000000
    2010-01-01 17:23:02.940 Untitled[3708:207] -----
    2010-01-01 17:23:02.941 Untitled[3708:207] touchesBegan - self.powerOn.center is 215.000000, 90.000000
    2010-01-01 17:23:11.199 Untitled[3708:207] -----
    2010-01-01 17:23:11.200 Untitled[3708:207] touchesBegan - self.powerOn.center is 215.000000, 90.000000
    2010-01-01 17:23:11.663 Untitled[3708:207] -----
    2010-01-01 17:23:11.664 Untitled[3708:207] touchesBegan - self.powerOn.center is 215.000000, 90.000000
    2010-01-01 17:23:11.665 Untitled[3708:207] -----
    2010-01-01 17:23:11.665 Untitled[3708:207] touchesBegan - self.powerOn.center is 215.000000, 90.000000
    

    BTW, you’re leaking both backgroundImageView and powerOn.

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

Sidebar

Related Questions

I have a really simple search form with the following Label (Search) Textbox (fixed
I have a really simple ASP.NET web application and a web setup project that
I have a really simple WPF UserControl: <UserControl x:Class=dr.SitecoreCompare.WPF.ConnectionEntry xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml x:Name=connEntry BorderBrush=Navy BorderThickness=1
I have a really simple Java class that effectively decorates a Map with input
I have a really simple class with two methods; One that will be called
This is a (hopefully) really simple question - I have been told recently that
We’ve found that the unit tests we’ve written for our C#/C++ code have really
What should i use to code Classic ASP under Linux. I have really tried
I have some really complicated legacy code I've been working on that crashes when
I have a really big database (running on PostgreSQL) containing a lot of tables

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.