views:

17

answers:

2

Hi all,

I want that update in player controller song duration of song(which is downloaded from the server) from the playlist controller.

Actually i m using avaudioplayer so in player i have two controller avtouchcontroller and avtouchview controller,and one xib of avtouchviewcontroller where all things (play pause next prev song duration).

so in avtouch controller i have a method UpdatePlayerInfo if i call this function then my problem is solved.

How i call updateplayerinfo(which is in avtouchcontroller) function from other(avtouchviewcontroller).

A: 

take a iboutlet label in .h file and bind it with your xib file set the property of that label in .h file and synthesis that label in .m file.

Then in the class from where you want to change the label text set it using the object of the above class

EDIT: ADDED EXAMPLE EG: In classA you have the label in XIB then in CLASSA.h take iboutlet uilabel labelA set its property synthesize it and bind this with the label in XIB. Then goto CLASSB take objct of class A and objClassA.labelA=@"CHAANGEDVALUE"

ClassA.h
UILabel *myLabel;

@property(nonatomic,retain)IBOutlet UILabel *myLabel;

.

ClassA.m
@synthesis mylabel.

NOW go to XIB file and in files owner inspector you will find mylabel BIND it with your label in xib.

ClassB.m//Accesing label in Another Class
ClassA objClassA;//ALOCATE THE INSTANCE
objClassA.myLabel=@"NEWVALUE";

hAPPY cODING...

Suriya
U r right but Actually i want to update one viewController Xib from another class.
Arun Sharma
dats what i have said... like for example in class A you bave the label in XIB then `in CLASSA.h take iboutlet uilabel labelA set its property synthesize it` and bind this with the label in XIB. Then goto CLASSB take objct of class A and `objClassA.labelA=@"CHAANGEDVALUE"`
Suriya
hi Arun, I have edited my answer and added example for better understanding...
Suriya
A: 

You should create instance variable UILabel *someLabel; in target class and add IBOutlet property to it. (or just IBOutlet UILabel *someLabel;).
Next step is to make relation (in IB) between displayed label and outlet.
Step 3. Profit (manage instance variable as you wish).

kpower