• Apfeltalk ändert einen Teil seiner Allgemeinen Geschäftsbedingungen (AGB), das Löschen von Useraccounts betreffend.
    Näheres könnt Ihr hier nachlesen: AGB-Änderung
  • Einige Blicke in fremde Welten dürft Ihr nun bestaunen und darüber abstimmen, welche davon Euch am meisten gefällt: hier geht es lang für Euer Voting --> Klick

Daten übernehmen

  • Ersteller Ersteller Mini-mc
  • Erstellt am Erstellt am

Mini-mc

Gast
Hallo,
Ich habe folgende frage/Problem.
Ich möchte das man im ersten View z.b. Name angeben kann, klickt auf Übernehmen und es erscheint im Zweiten View.
Ich möchte mit Labels und Textlabels arbeiten. Gedacht hatte ich das über einen NSString zu steuern. Aber wie sieht es jetzt im Detail aus?

Danke und Frohe Weihnachten,
Mini Mc

P.s. Ich habe schon die Sufu genutzt, aber nichts Gefunden :-(
 
Dir scheinen da erhebliche Grundlagen zu fehlen. Aber:

* Was hast Du versucht?
* Was klappt nicht?
* Kannst Du den Sourcecode hochladen, damit wir mal sehen können was Du da machst?

Alex
 
Erstmal Danke für die Hilfe.
1.) Ich habe das mit diesem Programmcode versucht:


-(IBAction)uebernehmen:(id)sender;
{
NSString* Teamname1 = [Team_name1 setringValue];
[Team1 setStringValue:Teamname1];
}
Wenn ich auf Übernehmen klicke Verweist mich der iPad Simulator auf die Textstelle und Stürzt ab.
Verknüpft habe ich die Ganzen Funktionen, selbstverständlich.
Team_name1 = Textfield
Team1 = UILabel
Teamname1 = NSString

Danke
 
Wenn da wirklich "setringValue" steht wunder mich das nicht.

Lad doch mal den Code hoch

Alex
 
Das ist nur ein sehr kleiner Ausschnitt

Alex
 
#import "Leiter.h"

@implementation leiterAppDelegate


@synthesize window = _window;
@synthesize tabBarController = _tabBarController;


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
// Add the tab bar controller's current view as a subview of the window
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
return YES;
}


- (void)applicationWillResignActive:(UIApplication *)application
{
/*
Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
*/
}


- (void)applicationDidEnterBackground:(UIApplication *)application
{
/*
Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
*/
}


- (void)applicationWillEnterForeground:(UIApplication *)application
{
/*
Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
*/
}


- (void)applicationDidBecomeActive:(UIApplication *)application
{
/*
Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
*/
}


- (void)applicationWillTerminate:(UIApplication *)application
{
/*
Called when the application is about to terminate.
Save data if appropriate.
See also applicationDidEnterBackground:.
*/
}


- (void)dealloc
{
[_window release];
[_tabBarController release];
[super dealloc];
}


/*
// Optional UITabBarControllerDelegate method.
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController
{
}
*/


/*
// Optional UITabBarControllerDelegate method.
- (void)tabBarController:(UITabBarController *)tabBarController didEndCustomizingViewControllers:(NSArray *)viewControllers changed:(BOOL)changed
{
}
*/





-(IBAction)Leeren:(id)sender;
{


Team_name1.text = @"";




}
-(IBAction)uebernehmen:(id)sender;
{
NSString* Teamname1;
Teamname1 = [Team_name1 StringValue];
[Team1 setStringValue:Teamname1];
}


@end
Ist es so Besser?Wenn wir gerade beim Thema sind: Ich habe auch das Problem das ich die App im Landscape modus verwenden möchte diese sich aber immer im Portrait modus Öffnet?Mini-Mc
 
Lad doch mal das Projekt hoch, damit ich mir das am lebenden Objekt ansehen kann

Alex
 
So, Code bekommen. Was für eine Fehlermeldung bekommst Du denn?

Mit Sicherheit sowas wie "blah may not respond to message StringValue" ... natürlich nicht, denn C ist case-senstive. Es muss also stringValue heissen. Da hast Du GARANTIERT auch eine Warning in Xcode

Alex
 
Nein es kommt: "UILabel" not Respond to -stringValue.
Ich habe das geändert mit dem Groß/Kleinschreiben es hat sich aber so gesehen nichts geändert.
 
Dann hätte ich gerne mal das Projekt, so das man's bauen kann.

Meine Glaskugel ist nämlich gerade in Reperatur

Alex
 
Spätestens wenn man diese Meldung bekommt, sollte man mal einen Blick in die Dokumentation werfen. UILabel kennt keine Methode stringValue. Stattdessen hat UILabel eine Property text.

MacApple
Sorry aber daraus wurde ich nicht schlauer kannst du Vielleicht das was du Konkret meinst Schreiben?
Danke :-)
Jonas
 
Ganz konkret: statt setStringValue: oder stringValue benutzte einfach setText: bzw. text oder Du verwendest die Dot-Notation.
Code:
label.text = @"Ich bin ein Text";
Aber wie Alex schon in seiner ersten Antwort schrieb, Dir fehlen erhebliche Grundlagen.

MacApple
 
  • Like
Reaktionen: Mini-mc
Danke :-) Genau so habe ich mir Eigentlich die Hilfe Vorgestellt ;-)
 
Zuletzt bearbeitet von einem Moderator:
Hilfe sollte aber immer eine Hilfe zur Selbsthilfe sein.

Natürlich kann man Dir hier einfach fertigen Code hinwerfen. Aber dann hast Du nichts gelernt

Alex