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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T22:10:46+00:00 2026-06-18T22:10:46+00:00

in Viewdidload where CandidateView is custom viewcontroller for (int i = 0; i <

  • 0

in Viewdidload where CandidateView is custom viewcontroller

for (int i = 0; i < 9 ; i++) {
    for (int j = 0; j < 3; j++) {
        CandidateView *candView = [[CandidateView alloc]init];
        candView.view.frame = CGRectMake(15 + i*186 ,17 + j*145, 158,130);
        [candView.btnCandidate addTarget:self action:@selector(wasDragged:withEvent:) forControlEvents:UIControlEventTouchDragInside];
        [mainScroll addSubview:candView.view];
    }
}

This is the method

-(void)wasDragged:(UIButton *)button withEvent:(UIEvent *)event
{

    UITouch *touch = [[event touchesForView:button] anyObject];
    // get delta
    CGPoint previousLocation = [touch previousLocationInView:button];
    CGPoint location = [touch locationInView:button];
    CGFloat delta_x = location.x - previousLocation.x;
    CGFloat delta_y = location.y - previousLocation.y;

    // move button
    button.center = CGPointMake(button.center.x + delta_x,button.center.y + delta_y);
}

From this code i am able to move a button in the CandidateView.. Now i want to drag whole CandidateView or should I make UIView instead of UIViewcontroller.
Can anyone help me??
Thanks in advance..:)

  • 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-18T22:10:47+00:00Added an answer on June 18, 2026 at 10:10 pm

    Make a UIView and put everything inside of that, the UIView should fill the screen of your “UIViewController”, the dragging method should work fine for that too 🙂 Good luck! (*Another solution you might want to look into is making a UIScrollView that contains all of your objects nested in it)

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

Sidebar

Related Questions

//viewcontroller.m -(void)viewdidLoad { self.theOneViewController= [[TheOneViewController alloc]init]; [contentsView addSubview:self.theOneViewController.view]; } //theOneViewController - (void)viewDidLoad { .
- (void)viewDidLoad { webCollectionOnScroller=[[NSMutableArray alloc] init]; scroll = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 370, 320, 94)];
- (void)viewDidLoad{ UIView *baseView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)]; [self.view addSubview:baseView]; //
In viewDidLoad, I have this code: ProvRec *provRec = [[ProvRec alloc]init]; provRec.status = [NSString
I am using following code in viewDidLoad method CLLocationManager *locationManager = [[CLLocationManager alloc] init];
- (void)viewDidLoad { NSOperationQueue *operationQueue = [[NSOperationQueue alloc]init]; NSInvocationOperation *downloadImageOperation = [[NSInvocationOperation alloc] initWithTarget:[ImageDownloader
i create views in viewDidLoad,such as UIScrollView* scrollViewright = [[UIScrollView alloc] initWithFrame:CGRectMake(0,0,400,768)]; [scrollViewright setContentSize:CGSizeMake(400,1000)];
It appears that ViewDidLoad() is sent to a ViewController only after its View is
- (void)viewDidLoad { graph = [[CPTXYGraph alloc] initWithFrame: self.view.bounds]; CPTGraphHostingView *hostingView = (CPTGraphHostingView *)self.view;
-(void)viewDidLoad { if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) { imagePicker = [[UIImagePickerController alloc] init]; imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;

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.