• Wieder einmal haben uns unsere Apfeltalker tolle Fotos zur Abstimmung eingesandt. Welches ist Euer Favorit? Stimmt mit ab! Hier geht es zur Abstimmung --> Klick
  • Es ist bereits Apfeltalk-Tradition und wir möchten sie auch in diesem Jahr fortsetzen: Unser Apfeltalk-Weihnachtslogo-Wettbewerb hat begonnen! Gestaltet für uns das Weihnachtsbanner, das im Monat Dezember bis zum Weihnachtsfest unsere Webseite schmücken soll. Lasst Eurer Kreativität freien Lauf! Hier geht es zum Wettbewerb --> Klick

[Anfänger!!] iPhone App (Converter) Problem

gaol

James Grieve
Registriert
20.06.12
Beiträge
132
Also ich versuche gerade ein bisschen Objective-C zu lernen und Xcode zu nutzen.
Ich habe nun die
xjyViewController.m
Code:
- ([COLOR=#0433FF]void[/COLOR]) convertTemp: ([COLOR=#0433FF]id[/COLOR]) sender {[COLOR=#3495AF][COLOR=#000000]    [/COLOR][COLOR=#0433ff]double[/COLOR][COLOR=#000000] farenheit = [[/COLOR]tempText[COLOR=#000000].[/COLOR]text[COLOR=#000000] [/COLOR]doubleValue[COLOR=#000000]];[/COLOR][/COLOR]
    [COLOR=#0433ff]double[/COLOR] celsius = (farenheit - 32) / 1.8;
    [COLOR=#3495af]NSString[/COLOR] *resultString = [[[COLOR=#3495af]NSString[/COLOR] [COLOR=#3495af]alloc[/COLOR]] [COLOR=#3495af]initWithFormat[/COLOR]:[COLOR=#b4261a]@"Celsius %f"[/COLOR], celsius];
    [COLOR=#3495af]resultLabel[/COLOR].[COLOR=#3495af]text[/COLOR] = resultString;
    
}
- ([COLOR=#0433ff]void[/COLOR]) viewDidUnload{
[COLOR=#3495AF][COLOR=#000000]    [/COLOR][COLOR=#0433ff]self[/COLOR][COLOR=#000000].[/COLOR]resultLabel[COLOR=#000000] = [/COLOR][COLOR=#0433ff]nil[/COLOR][COLOR=#000000];[/COLOR][/COLOR]
    [COLOR=#0433ff]self[/COLOR].[COLOR=#3495af]tempText[/COLOR] = [COLOR=#0433ff]nil[/COLOR];
}
xjyViewController.h
Code:
[COLOR=#0433FF]@interface[/COLOR] xjyViewController : [COLOR=#3495AF]UIViewController[/COLOR] {    [COLOR=#3495af]UITextField[/COLOR] *tempText;
    [COLOR=#3495af]UILabel[/COLOR] *resultLabel;
}
[COLOR=#0433FF]@property[COLOR=#000000] ([/COLOR]nonatomic[COLOR=#000000], [/COLOR]retain[COLOR=#000000]) [/COLOR]IBOutlet[COLOR=#000000] [/COLOR][COLOR=#3495af]UILabel[/COLOR][COLOR=#000000] *resultLabel;[/COLOR][/COLOR]
[COLOR=#0433FF]@property[COLOR=#000000] ([/COLOR]nonatomic[COLOR=#000000], [/COLOR]retain[COLOR=#000000]) [/COLOR]IBOutlet[COLOR=#000000] [/COLOR][COLOR=#3495af]UITextField[/COLOR][COLOR=#000000] *tempText;

[/COLOR][/COLOR]
- ([COLOR=#0433FF]IBAction[/COLOR])convertTemp:([COLOR=#0433FF]id[/COLOR])sender;

Nur leider passiert nichts wenn ich den Button drücke (im interfacebuilder ist soviel ich weiss alles verbunden tempText, resultLabel und die IBAction).
 
Ich würde erst einmal darauf tippen, das nicht alles verbunden ist.

Prüfe, ob die Action verbunden ist und setze dann einen Breakpoint auf convertTemp:

Alex