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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:05:26+00:00 2026-05-31T09:05:26+00:00

I am a new ios developer. I want to create an ios app where

  • 0

I am a new ios developer. I want to create an ios app where i want to add two view.At first when app start then first view will show. There will be a button . When tap on button then the second view is show on the screen from left to right and Not full screen but half part on the screen.
How can i do that.
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-05-31T09:05:28+00:00Added an answer on May 31, 2026 at 9:05 am

    It’s actually quite easy with the help of UIView’s animateWithDuration wrapper. If you are unfamiliar with blocks, this is also an excellent learning opportunity.

    First, declare two UIView objects in the .h and define the method you want to hook up to the button:

    @interface Example : UIViewController
    {
        UIView *_view1;
        UIView *_view2;
    }
    @property (nonatomic, retain) UIView *view1;
    @property (nonatomic, retain) UIView *view2;
    -(IBAction)animateViews:(id)sender;
    
    @end
    

    Now in the .m, define your action (notice it’s return type changes to void, but it’s signature stays the same):

    #import "Example.h"
    
    @implementation Example
    @synthesize view1 = _view1;
    @synthesize view2 = _view2;
    
    -(void)viewDidLoad {
        //alloc and init views, add to view
        self.view1 = [[UIView alloc]initWithFrame:[UIScreen mainScreen].bounds];
        self.view2 = [[UIView alloc]initWithFrame:CGRectMake(self.view.bounds.size.width, 0, self.view.bounds.size.width/2, self.view.bounds.size.height)];
        //Set the background color so we can actually see the views, the first will be grey, the second, black.
        [self.view1 setBackgroundColor:[UIColor grayColor]];
        [self.view2 setBackgroundColor:[UIColor darkTextColor]];
        //add subview to main view
        [self.view addSubview:self.view1];
        [self.view addSubview:self.view2];
    
        [super viewDidLoad];
    }
    
    -(void)animateViews:(id)sender {
    
             /*I absolutely love the UIView animation block, 
     it's possibly the most helpful thing in terms of animation apple could have made.  
     Any property changed inside this block (in this case, the frame property), 
     is automatically animated for the duration you specify.  
     It's even got a built in completion block!  So cool.*/
    
        [UIView animateWithDuration:2.5 animations:^{
            [self.view1 setFrame:CGRectMake(0, 0, self.view.bounds.size.width/2, self.view.bounds.size.height)];
            [self.view2 setFrame:CGRectMake(self.view.bounds.size.width/2, 0, self.view.bounds.size.width/2, self.view.bounds.size.height)];
         }];
    
    }
    
    @end
    

    This should animate the frame of the first view to take up half of the screen, and then animate the second view to sort of fly in and take up the other half. Make sure to hook up that IBAction to a button in a XIB before you run it though.

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

Sidebar

Related Questions

First of all, I am a a very new Objective C/Cocoa iOS Developer but
We have iOS Enterprise Account. Right now we want to add a developer to
I'm new to IOS development, and want to create something with tiles similar to
The tableview is populated from a .plist. I want to be create an ADD
I am a new iOS developer. I got a very basic doubt. I read
i am iOS app developer. Now when i created an app on iOS i
I want to store user credentials in the keychain. I found this: http://developer.apple.com/library/ios/#samplecode/GenericKeychain/Listings/Classes_KeychainItemWrapper_m.html#//apple_ref/doc/uid/DTS40007797-Classes_KeychainItemWrapper_m-DontLinkElementID_10 I
New to iOS development, I've been following the tutorials on developer.apple.com, and am now
I am new in iOS developer. Now I am working at a background location
guys I'm a new iOS developer, I'm having a problem when calling soap functions

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.