0

Need help for that.

I have a tabbar with 2 views, A and B (tableviews).

In view B viewDidLoad i call [self start]; which is a NSMutableURLRequest.

   -(void)start
    {
    NSMutableURLRequest  * //my code here....


NSString *temp = [[NSString alloc] initWithFormat: @"%d", [myArray count]];

[(UIViewController*)[self.tabBarController.viewControllers objectAtIndex:1] tabBarItem].badgeValue =temp;

    }

I need to call this function -(void)start from my view A to have a badgeValue in my viewController objectAtIndex:1;

Thanks for reading.

iamsult
  • 1,581
  • 1
  • 15
  • 21
XcodeMania
  • 305
  • 5
  • 20
  • You can use Singleton pattern, take a look at this post [singleton class in objective-C][1] [1]: http://stackoverflow.com/questions/5438629/singleton-class-in-objective-c – Scar Feb 14 '12 at 10:56

2 Answers2

2

How I understand you you need a reference to your view B to call the start method...

In view A:

UITableView* b = a;
[b start];

Or do I not understand your question?

Tobi Weißhaar
  • 1,617
  • 6
  • 26
  • 35
0

What i understand that you want to access a value from an array at index row 1. View A should have that value.

So what i recommend is create a class function for view B. Assign the value to the instance of the class function. Now declare a instance of View B in View and call that function.

Hope it helps.

iamsult
  • 1,581
  • 1
  • 15
  • 21