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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:43:16+00:00 2026-05-29T11:43:16+00:00

all. I’m making app TabBar with two views(ScrollView and TableView). When application launched, TabBar

  • 0

all.

I’m making app TabBar with two views(ScrollView and TableView).

When application launched, TabBar button appear, and can change two views.

I programmed push button in TableView to change ScrollView, and view is change.
but TabBar is disappear.

someone, please help! advice me.

application image:
http://www.0502.me/help/xcode_why.png

Item View Controller(TableView)

#import "FirstViewController.h"
#import "SecondViewController.h"

@implementation FirstViewController

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
}

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
}

- (void)viewDidDisappear:(BOOL)animated
{
    [super viewDidDisappear:animated];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
        return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
    } else {
        return YES;
    }
}

- (IBAction)pageOne:(id)sender {
//Below code is switch View
    SecondViewController *secondView = [self.storyboard instantiateViewControllerWithIdentifier:@"SecondView"];
    [self presentModalViewController:secondView animated:YES];
}

- (IBAction)pageTwo:(id)sender {
}

- (IBAction)pageThree:(id)sender {
}
@end

Second View Controller(ScrollView)

#import "SecondViewController.h"

@implementation SecondViewController

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];

    // Release any cached data, images, etc that aren't in use.
}


#pragma mark - View lifecycle

-(void)pageLoad:(UIScrollView *)scrollView {
    currentPage = scrollView.contentOffset.x / scrollView.bounds.size.width;
    int pageWidth = self.view.frame.size.width;
    int pageHeight = self.view.frame.size.height;

    prevPage.frame = CGRectMake(
                                pageWidth * (currentPage - 1),
                                0,
                                pageWidth,
                                pageHeight
                                );
    if (currentPage > 0) {
        [prevPage setImage:[NSString stringWithFormat:@"%d", (currentPage - 1) % kPageNum]];
        prevPage.hidden = NO;
    } else {
        prevPage.hidden = YES;
    }

    currPage.frame = CGRectMake(
                                pageWidth * currentPage,
                                0,
                                pageWidth,
                                pageHeight
                                );

    [currPage setImage:[NSString stringWithFormat:@"%d", currentPage % kPageNum]];
    currPage.hidden = NO;

    nextPage.frame = CGRectMake(
                                pageWidth * (currentPage + 1),
                                0,
                                pageWidth,
                                pageHeight
                                );


    if (currentPage < (kPageNum - 1)) {
        [nextPage setImage:[NSString stringWithFormat:@"%d", (currentPage + 1) % kPageNum]];
        nextPage.hidden = NO;
    } else {
        nextPage.hidden = YES;
    }

}


// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
{
    [super viewDidLoad];

    UIScrollView *scrollView = [[UIScrollView alloc] init];

    scrollView.frame = self.view.bounds;
    scrollView.contentSize = CGSizeMake(self.view.frame.size.width * kPageNum, self.view.frame.size.height);
    scrollView.pagingEnabled = YES;
    [self.view addSubview:scrollView];

    scrollView.delegate = self;

    prevPage = [[PageView alloc] initWithFrame:self.view.bounds];
    [scrollView addSubview:prevPage];

    currPage = [[PageView alloc] initWithFrame:self.view.bounds];
    [scrollView addSubview:currPage];

    nextPage = [[PageView alloc] initWithFrame:self.view.bounds];
    [scrollView addSubview:nextPage];

    [self pageLoad:scrollView];
}

- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
    CGFloat position = scrollView.contentOffset.x / scrollView.bounds.size.width;
    CGFloat delta = position - (CGFloat)currentPage;

    if (fabs(delta) >= 1.0f) {
        [self pageLoad:scrollView];
    }
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

@end
  • 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-29T11:43:18+00:00Added an answer on May 29, 2026 at 11:43 am

    You’re presenting it as a modal view. If I understand your question, you just want to switch the selected item in your UITabBar. You can do that like this:

    self.tabBarController.selectedIndex = index;
    

    Where index is an integer representing the index of the UIViewController you want to switch to. In your case, it looks like index should be 0.

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

Sidebar

Related Questions

All I want is to be able to change the color of a bullet
All throughout an application wherever error messages (or other user messages) are used I
All, I currently have two projects that are under SourceSafe that I am unable
All I can find information on for the URLLoader object in Actionsript 3.0 involves
all. When buildstep fail, Can i get trigged and write script to do something,
All the examples I can find using DLLImport to call C++ code from C#
all, I am making a game in which a sprite is move from one
All I am trying to create an app that start capturing the video from
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
All the articles I've found via google are either obsolete or contradict one another.

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.