2016-06-24 1 views
-1

secondgpxstring in verwenden Dies ist mein CodeWie implementiert man eine einzelne Funktion durch die Übergabe von zwei String-Werte in ios? kann ich wissen, wie unten Programm

-(void)gpxFileParsing 
{ 
    NSString *gpxstring = [[NSBundle mainBundle]pathForResource:@"gpxtest" ofType:@"gpx"]; 
    NSString *seconGpxString = [[NSBundle mainBundle]pathForResource:@"secondGpxfile" ofType:@"gpx"]; 
    NSData *gpxdata = [NSData dataWithContentsOfFile:gpxstring]; 
} 
+0

was Sie tun möchten ?? können Sie mir im Detail –

+0

Ihre Frage ist sehr unklar. –

Antwort

0

Unterhalb der Methode „gpxFileParsing“ mit zwei Parameter geschrieben

NSString *firstParam = @"gpxtest"; // first param set in the first path 
NSString *secondParam = @"secondGpxfile"; //second param set in the second path 
NSData *getOutput = [self gpxFileParsing:firstParam seconGpxString:secondParam]; // call method like that and return value is "NSData" so get the data and store it in the "getOutput" variable 


-(NSData *)gpxFileParsing:(NSString *)gpxtest seconGpxString:(NSString *) secondGpxfile 
{ 
    NSString *gpxstring = [[NSBundle mainBundle]pathForResource:gpxtest ofType:@"gpx"]; 
    NSString *seconGpxString = [[NSBundle mainBundle]pathForResource:secondGpxfile ofType:@"gpx"]; 
    NSData *gpxdata = [NSData dataWithContentsOfFile:gpxstring]; 

    return gpxdata; 
} 

wenn Sie „seconGpxString“ Wert nur die ändern Methodenrückgabetyp "NSData -> NSString" und Rückgabewert "seconGpxString".

Verwandte Themen