开发者

iPhone SDK basics, one view available from several classes

开发者 https://www.devze.com 2023-01-12 08:49 出处:网络
I\'m curious if it\'s possible to create an application according to window-based pattern, add UILabel, create a new class, and to be able to change UILabel\'s value from this new class.

I'm curious if it's possible to create an application according to window-based pattern, add UILabel, create a new class, and to be able to change UILabel's value from this new class.

After creating all that files we will have:

  • NewApplicationDelegate.h, .m;
  • Newclass.h, .m;
  • MainWindow.xib.

The IBOutlet in this case must be added to MainWindow.xib, and I want to change its value from NewCalss.m. Is it possible? How can I do that?

The point is that I was workin开发者_高级运维g only with navigation-based or simple window-based applications before, and now I need to have one view available and changeable (UILabels, for example) from at least 2 other classes.

Thanks.


You will have a UIController object too - right?

That has a handle on the UI elements, UILabel etc, whichever you map through.

You could pass this to the Newclass or you could provide an interface/protocol that the controller exposes that allows Newclass to interact with what you want to do.

0

精彩评论

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