iPhone - Custom Class Won't Access Method -


I am trying my hand at some iPhone programming and I did something that is quite clear for the giants but I I am not sure why this is happening, I have two UIViewController classes, and I want to use one method from another class. I have two NSObject classes in the IB (with each class file as UpdateClass for each), and I'm trying to create a class and call a method. It seems very easy, but the problem is that this method is calling (according to NSLog), but this is not updating the label. Here's my code:

  // UpdateClass H #import & lt; Foundation / Foundation. H & gt; @ Interface update class: NSOBIES {IBOTTULL UILBL * LLB 1; IBOutlet UILabel * lbl2; } @property (nontomic, raten) IBOutlet UILabel * lbl1; @protecti (nanatomic, raten) IBotllet UILBLL 2; - (zero) update labels; @end //UpdateClass.m #import "UpdateClass.h" @ Implementation UpdateClass @ synthesis lbl1; @ Synthesis lbl2; - (zero) Update labels {NSString * someWord = @ "whatever"; // This can be some NSLog (@ "NSObject update"); [LLB 1st set text: some word]; [LLB2 set text: some word]; } @end //ViewController1.h #import & lt; UIKit / UIKit.h & gt; @ Class update class; @ Interface view controller 1: UIViewController {IBOutlet UIButton * button1; NSObject * UpdateClassObject; UpdateClass * updateClass; } @property (nontomic, retten) ibotlet UIButton * button1; @property (nonatomic, retain) NSObject * UpdateClassObject; @property (nonatomic, retained) UpdateClass * updateClass; - (zero) Update label: (ID) sender; @end //ViewController1.m #import "ViewController1.h" #import "UpdateClass.h" @ Implementation ViewController1 @ synthesis button 1; @ UpdateClassObject Synthesize; @Update update; - (zero) viewDidoadload [[Super Viewedload]; UpdateClass = [[Update class alloc] init]; } - (Zero) Update Label: (ID) Sender; {// This button is connected to touchdown on 1 NSLog (@ "Call Update Labels"); [UpdateClass Update Labels]; // class calls method} // ViewController2.h #import & lt; UIKit / UIKit.h & gt; @ Class update class; @ Interface view controller2: UIViewController {IBOutlet UIButton * button2; NSObject * UpdateClassObject; UpdateClass * updateClass; } @protecti (nanatomic, retten) ibotlet UIButton * button2; - (zero) Update label: (ID) sender; @end //ViewController2.m #import "ViewController2.h" #import "UpdateClass.h" @ Implementation ViewController2 @ synthesis button 2; @ UpdateClassObject Synthesize; @Update update; - (zero) viewDidoadload [[Super Viewedload]; UpdateClass = [[Update class alloc] init]; } - (Zero) Update Label: (ID) Sender; {// This button is linked to TouchDown on the NSLog 2 (@ "Call Update Labels"); [UpdateClass Update Labels]; // class calls the method}  

So for both scenes IB is inclined to an NSObject on each view labeled a label NSObject and the owner of the file (both of them to hook up Can not be necessary) until harvested. When the button is pressed (which is tilted up properly in the IB), the label is considered to be converted to a few strings. NSLog reports that methods are called, but labels do not change. What's wrong here?

(Note: There may be some minor mistakes because I had to write some of these as I do not have all the code at the moment).

A word on design here:

You can use two or more visual control implementations Want to share some functionality between In this case, you can create a common base class that is obtained from the UIViewController and receives two views from that class. BASView will declare an outlet for common UI components that you can add to the IB.

  @ interface BASUIviewController: UIViewController {IBOutlet UILabel * lbl1; IBOutlet UILabel * lbl2; } @property (nontomic, raten) IBOutlet UILabel * lbl1; @protecti (nanatomic, raten) IBotllet UILBLL 2; - (zero) update labels; @end  

...

  @interface ViewController1: BaseUniview controller {IBOutlet UIButton * button1;  

...


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -