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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:09:23+00:00 2026-06-17T13:09:23+00:00

I have a tabbed application with two tabs. on the second tab, I plot

  • 0

I have a tabbed application with two tabs.

on the second tab, I plot a graph.

But every time I press this tab, the UIview is not getting refreshed.

I tried,

[self.view setNeedsDisplay]

inside

- (void)viewDidLoad

but still it was not refreshed.

I tried pasting the code from - (void)viewDidLoad to -(void)viewDidAppear

But nothing happened.

Awaiting an answer.

Edit: The whole source code

- (void)viewDidLoad
{

    //[self.view setNeedsDisplay];

    Sensor_VisualizationAppDelegate *delegate = (Sensor_VisualizationAppDelegate *)[[UIApplication sharedApplication] delegate];
    valuePass = delegate.valuepass;
    timePass = delegate.timepass;

    NSNumber *value1 = [valuePass objectAtIndex:0];
    NSNumber *value2 = [valuePass objectAtIndex:1];
    NSNumber *value3 = [valuePass objectAtIndex:2];
    NSNumber *value4 = [valuePass objectAtIndex:3];
    NSNumber *value5 = [valuePass objectAtIndex:4];
    NSNumber *value6 = [valuePass objectAtIndex:5];
    NSNumber *value7 = [valuePass objectAtIndex:6];



    NSString *time1 = [timePass objectAtIndex:0];
    NSString *time2 = [timePass objectAtIndex:1];
    NSString *time3 = [timePass objectAtIndex:2];
    NSString *time4 = [timePass objectAtIndex:3];
    NSString *time5 = [timePass objectAtIndex:4];
    NSString *time6 = [timePass objectAtIndex:5];
    NSString *time7 = [timePass objectAtIndex:6];



    OVGraphView *graphview=[[OVGraphView alloc]initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.height, 300) ContentSize:CGSizeMake(960, 300)];
    graphview.reverse=YES;
    graphview.graphcolor=[UIColor colorWithRed:0.31 green:0.73 blue:0.78 alpha:1.0];
    [self.view addSubview:graphview];
    [graphview setPoints:@[ [[OVGraphViewPoint alloc]initWithXLabel:time1 YValue:value1],
     [[OVGraphViewPoint alloc]initWithXLabel:time2 YValue:value2],
     [[OVGraphViewPoint alloc]initWithXLabel:time3 YValue:value3],
     [[OVGraphViewPoint alloc]initWithXLabel:time4 YValue:value4],
     [[OVGraphViewPoint alloc]initWithXLabel:time5 YValue:value5],
     [[OVGraphViewPoint alloc]initWithXLabel:time6 YValue:value6],
     [[OVGraphViewPoint alloc]initWithXLabel:time7 YValue:value7]
     ]];

[super viewDidLoad];    
}
  • 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-17T13:09:24+00:00Added an answer on June 17, 2026 at 1:09 pm

    To detect tab bar touches you can implement the UITabBarController Delegate as follows:

      - (void)tabBarController:(UITabBarController *)tabBarController 
     didSelectViewController:(UIViewController *)viewController
    {
        NSLog(@"controller class: %@", NSStringFromClass([viewController class]));
        NSLog(@"controller title: %@", viewController.title);
    }
    

    Where you created your tab bar. Then you can get an instance of the view of the view controller and call setNeedsDisplay

    In the source code for the ovgraphview, somewhere along the way after you call setPoints this method is called:

    -(void)setPlotViewPoints:(NSArray *)points Reversed:(BOOL)reversebool{
        if (reversebool) {
           self.plotpoints=[[points reverseObjectEnumerator]allObjects];
        }else{
            self.plotpoints=points;
        }
        spacebetweenpoints=self.frame.size.width/[points count];
        int d=0;
        for (OVGraphViewPoint *pt in points) {
            if ([pt.yvalue intValue]>d) {
                d=[pt.yvalue intValue];
            }
        }
        yscale=(self.frame.size.height-40)/d;
        [self setNeedsDisplay];
    }
    

    In the last line you see they are call calling setNeedsDisplay on the view after the points are set, so there is no need for you to call it before the graph is created. but since you did, it appears that this messed with the internal implantation of the graph. When you call setNeedsDisplay it waits until the next run loop cycle to display and so will the one called in the method above. Now we have more than one being called on different layers in the view hierarchy and it gets nasty. I think that is where the problem is.

    For your case I would leave setNeedsDisplay out altogether and either just call setPoints in the delegate method I gave above or if you are not using a tabbarcontroller than implement tabBar:didSelectItem: of the tab bar delegate to detect when your tab was clicked either by assigning a tag to the tab bar item when you create it or checking its title to verify its the one you want, then call set points.

    This was a bit long winded let me know if you need me to try and clarify it more.

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

Sidebar

Related Questions

What i have is a tabbed page with 12 tabs (every tab is a
I have a tabbed application and when I click on the second tab, an
I have Tabbed Application with 5 tabs. App starts on tab with index 0
I have a tabbed application with 3 tabs The first tab is a table
I have a Tabbed Application which has six tabs, so as expected two of
I have an android tabbed application and inside one of my tabs is an
If I have a tabbed iphone application, how do I communicate from one tab
I have a tabbed application with navigation controllers in tabs and view controller in
I have a tabbed application with navigation controllers in tabs and view controller in
I created a tabbed application in which I have three tabs. In the first

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.