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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T15:25:11+00:00 2026-06-08T15:25:11+00:00

So what I am trying to do with this view is make it so

  • 0

So what I am trying to do with this view is make it so that i can slide the UIView (menuView) up and down in and out of the screen. So in storyboard/IB i placed a UIView and connected it to files owner and all that jazz. then i entered the program the below code. The problem is that when the nib loads it doesnt put the UIView where it should be in the first place and then the swipe doesn’t work on it. I tried this method of programming with a button and it worked fine. Thanks in advance for any help you may have on the subject.

.h file

UIView *menuView;
}
@property (strong, nonatomic) IBOutlet UIView *menuView;

.m file

@synthesize menuView;



- (void)viewDidLoad
{
[super viewDidLoad];

// Do any additional setup after loading the view.

UISwipeGestureRecognizer *swipeGesture = [[UISwipeGestureRecognizer alloc]     initWithTarget:self action:@selector(swipe:)];
[swipeGesture setDirection:UISwipeGestureRecognizerDirectionDown];
[self.view addGestureRecognizer:swipeGesture];


menuView = [[UIView alloc] initWithFrame:CGRectMake(0, -80, 320, 80)];
[menuView setFrame:CGRectMake(0, -80, 320, 80)];

[self.view addSubview:menuView];
}


-(void)swipe:(UISwipeGestureRecognizer*)sender {
[UIView animateWithDuration:0.5 animations:^{
    [menuView setFrame:CGRectMake(0, 0, 320, 80)];
}];
    }



 - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
    // Custom initialization
}
return self;
 }
  • 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-08T15:25:15+00:00Added an answer on June 8, 2026 at 3:25 pm

    You’ve set up your menuView as a storyBoard/IB outlet. That means the xib/nib/storyboard is doing the alloc-init and initial framing. So you should remove this line:

    menuView = [[UIView alloc] initWithFrame:CGRectMake(0, -80, 320, 80)];
    

    You can also remove the next line from viewdidLoad:

    [menuView setFrame:CGRectMake(0, -80, 320, 80)];
    

    There it’s superfluous. It was already done by “initWithFrame” — which is already done by the nib.

    On the other hand, it might be hard to position something offscreen in a nib. So you might actually reinstate the setFrame: line — but in viewWillAppear rather than viewDidLoad. viewWillAppear is called after the nib has done its thing, so the nib is out of the way and won’t interfere with your reframing.

    Make those changes and, if “all that jazz” includes connecting menuView to a reference outlet, you should be good to go.

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

Sidebar

Related Questions

I'm trying to make a timeline view that shows events as UIButtons that can
I'm trying to make a custom view in Django admin. I'm reading from this
I'm trying to build a view that operators something similar to this: The user
I'm trying to make an app that can take images from a directory on
I'm trying to make a custom segue so that the destination view controller slides
I am trying to accomplish this: Consider a table view with Search Bar on
I am trying to generate a UITextField in a view like this. I don't
I am trying to achieve exactly something like this - a text view on
Got this error message while trying to load view: The model item passed into
This is what I am trying to do Create a UIImage View. Do some

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.