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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:38:37+00:00 2026-06-12T04:38:37+00:00

Here is my code: @interface UserProfileViewController : UIViewController<UIGestureRecognizerDelegate>{ } @property (nonatomic, retain) UILabel *myLabel;

  • 0

Here is my code:

@interface UserProfileViewController : UIViewController<UIGestureRecognizerDelegate>{

}

@property (nonatomic, retain) UILabel *myLabel;
@property (nonatomic, retain) UIImageView *imageView;

@end

@implementation UserProfileViewController

@synthesize myLabel;
@synthesize imageView;

- (void)viewDidLoad
{
[super viewDidLoad];

UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
scrollView.contentSize = CGSizeMake(320, 700);
scrollView.clipsToBounds = YES;
[scrollView setUserInteractionEnabled:YES];

myLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 200, 40)];
myLabel.text = @"Kim Gysen";
myLabel.center = CGPointMake(CGRectGetWidth(self.view.bounds)/2.0f, 25);
myLabel.textAlignment = NSTextAlignmentCenter;
myLabel.textColor = [UIColor whiteColor];
[myLabel setBackgroundColor:[UIColor clearColor]];

self.imageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 140, 180)];
self.imageView.center = CGPointMake(CGRectGetWidth(self.view.bounds)/2.0f, 150);
UIImage *image = [UIImage imageNamed: @"ProfilePic.jpeg"];
[imageView setImage:image];

//Long press

self.imageView.userInteractionEnabled = YES;
UILongPressGestureRecognizer *longPressGestureRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPressFrom:)];
longPressGestureRecognizer.delegate = self;
[self.imageView addGestureRecognizer:longPressGestureRecognizer];

[scrollView addSubview:myLabel];
[scrollView addSubview:imageView];
[self.view addSubview:scrollView];

}

- (void) handleLongPressFrom: (UISwipeGestureRecognizer *)recognizer
{
    CGPoint location = [recognizer locationInView:self.view];

    NSLog(@"Tap Gesture Coordinates: %.2f %.2f", location.x, location.y);
    if(UIGestureRecognizerStateBegan == recognizer.state)
    {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Gesture Recognizer Demo"
                                                        message:@"Long Press Gesture performed"
                                                       delegate:nil
                                              cancelButtonTitle:@"OK"
                                              otherButtonTitles:nil, nil];
        [alert show];
    }
}

I get no errors in my ViewDidLoad, but the BAD_EXC_ACCESS error appears on the long press, before the method is actually fired. I understood that I’m leaking somewhere but where?
I’m using ARC…

  • 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-12T04:38:39+00:00Added an answer on June 12, 2026 at 4:38 am

    You should make a property in your main view controller (typed strong) that points to the ProfileViewController then use:

    self.profileView = [[UserProfileViewController alloc] init]; 
    [self.view addSubview: self.profileView.view];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider the following code: @interface ClassA : NSObject @property (nonatomic, copy) void(^blockCopy)(); @end @implementation
See the code here @interface StaticView : UIView { Properties *prop; } @property (retain)
Here is 2 code snapshot- @interface A:NSObject { NSMutableArray *a; } @property (retain) NSMutableArray
I have the following code: @interface NeighborProfileViewController : UIViewController { UIImageView * profPic; UITextView
Here's the code: @interface myClass { std::vector<float> myVector } @end It's leaking according to
Here is the code I'm having problems with: The interface: public interface anInterface {
So here is the code: interface A<T> { T Save(); } interface B :
I have a problem with this code: Header: @interface ViewController : UIViewController { IBOutlet
here is my .h code @interface ROSettingViewController : UITableViewController { UISwitch *switchCtl; UISwitch *switchCtl1;
Here's my code: @interface Game : Layer // this is from cocos2d { int

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.