开发者

problem while calling function from one class to another class

i am creating a view based project named test,it contains testappdelegate.h,testappdelegate.m,test.h,test.m classes.

i am creating two NSObject classes named webservices.h,webservices.m

i have a method named 开发者_运维知识库getsource in class test.m.

now i need to call this method from webservices.m

For that i am writing the code like this.

[self performSelector:@selector(mymethod) withObject:nil afterDelay:4.0];

- (void)mymethod {

 MortgageCalculatorViewController *obj = [[MortgageCalculatorViewController alloc]init];
 [obj getsource];
}

it prints NSLog values in console,And it calls ViewDidLoad also,But there is no UIChanges.

i am trying using this

- (void)mymethod {

     MortgageCalculatorViewController *obj = [[MortgageCalculatorViewController alloc]init];
     [obj viewDidLoad];
    }

there No error but application quits.

And i am trying this in test.m class

[self performSelector:@selector(getsource) withObject:nil afterDelay:4.0];

Then it works fine.

can any one pls help me.

Thank u in advance.


calling ViewDidLoad wouldb't load the view for that class. You'd have to do [self.view addSubView:testClassObject.view].

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜