• Apfeltalk ändert einen Teil seiner Allgemeinen Geschäftsbedingungen (AGB), das Löschen von Useraccounts betreffend.
    Näheres könnt Ihr hier nachlesen: AGB-Änderung
  • Was gibt es Schöneres als den Mai draußen in der Natur mit allen Sinnen zu genießen? Lasst uns teilhaben an Euren Erlebnissen und macht mit beim Thema des Monats Da blüht uns was! ---> Klick

Instanzvariablen in einer 2. View ändern - mit Properties?

Answer

Wohlschmecker aus Vierlanden
Registriert
25.06.09
Beiträge
238
Hallo ihr Lieben,
Ich habe in meiner iGuessViewController.h folgendes stehen:

Code:
[COLOR=#cf3125][COLOR=#77492d]#import [/COLOR]<UIKit/UIKit.h>[/COLOR]


[COLOR=#508186][COLOR=#b933a1]@class[/COLOR]SecondView[COLOR=#000000];[/COLOR][/COLOR]



[COLOR=#b933a1][COLOR=#b933a1]@interface[/COLOR] iGuessViewController : [COLOR=#7041a7]UIViewController[/COLOR] {[/COLOR]
[COLOR=#B933A1]    [/COLOR]
[COLOR=#B933A1]    [COLOR=#b933a1]IBOutlet[/COLOR] [COLOR=#508186]SecondView[/COLOR] *secondVC;[/COLOR]
[COLOR=#B933A1]    [COLOR=#b933a1]IBOutlet[/COLOR] [COLOR=#7041a7]UIButton[/COLOR] *CheckButton;[/COLOR]
[COLOR=#B933A1]    [COLOR=#b933a1]IBOutlet[/COLOR] [COLOR=#7041a7]UITextView[/COLOR] *VerlaufTextView;[/COLOR]
[COLOR=#B933A1]    [COLOR=#b933a1]IBOutlet[/COLOR] [COLOR=#7041a7]UIPickerView[/COLOR] *picker1;[/COLOR]
[COLOR=#B933A1]    [COLOR=#7041a7]NSMutableArray[/COLOR] *arrayPicker1;[/COLOR]
[COLOR=#B933A1]    [COLOR=#b933a1]IBOutlet[/COLOR] [COLOR=#7041a7]UIPickerView[/COLOR] *picker2;[/COLOR]
[COLOR=#B933A1]    [COLOR=#7041a7]NSMutableArray[/COLOR] *arrayPicker2;[/COLOR]
[COLOR=#B933A1]    [COLOR=#b933a1]IBOutlet[/COLOR] [COLOR=#7041a7]UIPickerView[/COLOR] *picker3;[/COLOR]
[COLOR=#B933A1]    [COLOR=#7041a7]NSMutableArray[/COLOR] *arrayPicker3;[/COLOR]
[COLOR=#B933A1]    [COLOR=#b933a1]IBOutlet[/COLOR] [COLOR=#7041a7]UIPickerView[/COLOR] *picker4;[/COLOR]
[COLOR=#B933A1]    [COLOR=#7041a7]NSMutableArray[/COLOR] *arrayPicker4;[/COLOR]
[COLOR=#B933A1]    [COLOR=#b933a1]int[/COLOR] x;[/COLOR]
[COLOR=#B933A1]    [COLOR=#b933a1]int[/COLOR] o;[/COLOR]

[COLOR=#B933A1]    [COLOR=#b933a1]int[/COLOR] [COLOR=#b933a1]try[/COLOR];[/COLOR]
[COLOR=#B933A1]    [COLOR=#b933a1]int[/COLOR] pick1Read;[/COLOR]
[COLOR=#B933A1]    [COLOR=#b933a1]int[/COLOR] pick2Read;[/COLOR]
[COLOR=#B933A1]    [COLOR=#b933a1]int[/COLOR] pick3Read;[/COLOR]
[COLOR=#B933A1]    [COLOR=#b933a1]int[/COLOR] pick4Read;[/COLOR]
[COLOR=#B933A1]    [COLOR=#b933a1]int[/COLOR] numberOne;[/COLOR]
[COLOR=#B933A1]    [COLOR=#b933a1]int[/COLOR] numberTwo;[/COLOR]
[COLOR=#B933A1]    [COLOR=#b933a1]int[/COLOR] numberThree;[/COLOR]
[COLOR=#B933A1]    [COLOR=#b933a1]int[/COLOR] numberFour;[/COLOR]
[COLOR=#B933A1]    [COLOR=#b933a1]IBOutlet[/COLOR] [COLOR=#7041a7]UILabel[/COLOR] *XOLabel;[/COLOR]
[COLOR=#B933A1]    [COLOR=#b933a1]IBOutlet[/COLOR] [COLOR=#7041a7]UILabel[/COLOR] *VersuchLabel;[/COLOR]
[COLOR=#B933A1]    [COLOR=#b933a1]int[/COLOR] first;[/COLOR]
[COLOR=#B933A1]    [COLOR=#b933a1]int[/COLOR] second;[/COLOR]
[COLOR=#B933A1]    [COLOR=#b933a1]int[/COLOR] third;[/COLOR]
[COLOR=#B933A1]    [COLOR=#b933a1]int[/COLOR] fourth;[/COLOR]
[COLOR=#B933A1]}[/COLOR]
[COLOR=#B933A1]
[/COLOR]
[COLOR=#B933A1]-([COLOR=#b933a1]IBAction[/COLOR])einstellungenPressed;[/COLOR]
[COLOR=#B933A1]-([COLOR=#b933a1]IBAction[/COLOR])checkPressed;[/COLOR]
[COLOR=#B933A1]
[/COLOR]
[COLOR=#B933A1]@property[COLOR=#000000] ([/COLOR]nonatomic[COLOR=#000000], [/COLOR]retain[COLOR=#000000]) [/COLOR][COLOR=#508186]SecondView[/COLOR][COLOR=#000000] *secondVC;[/COLOR][/COLOR]
[COLOR=#B933A1]@property[COLOR=#000000] ([/COLOR]nonatomic[COLOR=#000000], [/COLOR]retain[COLOR=#000000]) [/COLOR][COLOR=#7041a7]UIPickerView[/COLOR][COLOR=#000000] *picker1;[/COLOR][/COLOR]
[COLOR=#B933A1]@property[COLOR=#000000] ([/COLOR]nonatomic[COLOR=#000000], [/COLOR]retain[COLOR=#000000]) [/COLOR][COLOR=#7041a7]UIPickerView[/COLOR][COLOR=#000000] *picker2;[/COLOR][/COLOR]
[COLOR=#B933A1]@property[COLOR=#000000] ([/COLOR]nonatomic[COLOR=#000000], [/COLOR]retain[COLOR=#000000]) [/COLOR][COLOR=#7041a7]UIPickerView[/COLOR][COLOR=#000000] *picker3;[/COLOR][/COLOR]
[COLOR=#B933A1]@property[COLOR=#000000] ([/COLOR]nonatomic[COLOR=#000000], [/COLOR]retain[COLOR=#000000]) [/COLOR][COLOR=#7041a7]UIPickerView[/COLOR][COLOR=#000000] *picker4;[/COLOR][/COLOR]
[COLOR=#B933A1]
[/COLOR]
[COLOR=#B933A1]@end[/COLOR]

und möchte nun in der SecondView.m (erreichbar durch einen Button in der iGuessViewController.m) ein paar oben deklarierte Variablen ändern. Zum genaueren Verständnis: Es ist ein "Neues Spiel" Button in der 2. View.

Habe recherchiert und habe gelesen ich sollte das am Besten mit Properties machen. Nur steht in meinem Obj-C Buch in dem Kapitel nichts was mir weiterhilft und die Beispiele im Internet sind auch nicht verständlicher.

Was muss ich nun in meiner iGuessViewController.h und in meiner SecondView.m ändern, um den Variablen einen Wert zu geben?
Bin über jede Hilfe dankbar - ich hoffe ihr verzeiht solche Anfängerfragen o_O

PS. Ich möchte unter anderem den Labeln XOLabel und VersuchLabel einen Text zuweisen können.