문제

I am a newbie in Objective-C. I stucked into a very big problem.

I have a ModelClass (named MyModel) for data management which is a subclass of NSObject... And to access the data the app needs authentication using a viewcontroller (say X) I don't have access to its properties (Actually it is a framework's viewcontroller)... I am accessing that model class from a viewController (named MyViewController)..and I want the retrieval along with authentication of data by calling one method of that model class...but, to present the uncontrolable viewcontroller X for authentication; I must use pushToViewController: method of UINavigationController SDK class. And I found that subclasses of NSObject class do not respond to navigationController.

But I really need to do this. Any kind of effective help is appreciated and thanks in advance.

도움이 되었습니까?

해결책

I've found a way to do this. I am giving the steps-

1> Create an UIViewController property (say obj) in MyModel.
2> Assign that obj to self(MyViewController's self object) just after creating the object of the model class(MyModel).
3> Put the following line in the model class from where to push to the target viewcontroller (for mine X)-

[self.obj pushViewcontroller:targetViewController animated:YES];


That's it. And thanks all.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top