XcodeMania
XcodeMania

Reputation: 305

Call function in a different view

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.

Upvotes: 0

Views: 106

Answers (2)

iamsult
iamsult

Reputation: 1579

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.

Upvotes: 0

Tobi Weißhaar
Tobi Weißhaar

Reputation: 1677

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?

Upvotes: 2

Related Questions