views:

153

answers:

2

Hey Guys,

I have a view with a button which downloads files when clicked.

Question I have is is it possible to call that click method from another view>

THanks

A: 

You have a method there. Something like onBtnClk. You can create in another view an instance of your viewController, that contains this method and send [myViewController onBtnClk].

Morion
Will this do it?QueueViewController *queueViewController = [QueueViewController alloc] initWithNibName:@"Queue" bundle:nil];[queueViewController onBtnClk]self.view=queueViewController.view;
harekam_taj
By the way this is not good solution. You should realize your download in some other class and just call it wherever you want.
Morion
And this is unnecessary to set self.view in your example.
Morion
A: 

This may be a good case to have some other class(maybe a singleton?) handle downloads, then have your click: method interact with the downloading class.

I know that everyone hates singletons, but this may be a good time to use one.

jessecurry