objective c - iphone SDK :How to add more string after an static URL? -


first...if no 1 can answer question it's ok...

because don't know how ask question in correctly description

my program plist data url , show on iphone tableview

my colleagues give me 2 url plist data

so have 2 tableviews(tableview1,tableview2)

two urls(url1,url2)

my tableview1 via url1 plist1 ,and tableview1 has 3 contents in first 3 rows

ex.(row0 id1),(row1 id2),(row2 id3)

when select row0 ,it jump tableview2 , title id1 on navgation bar

so far can do...

but @ tableview2 ,it need url like: www.url2.php?id=1 =>that means...

i have add tableview title after url2

to right plist related id 1

my question .......url2 static,how make dynamic right url address ???

well.....first time thought colleagues give me data array of array

but it's not...i never try use url dynamic...

this code in tableview1 let me plist url

 nsurlrequest *therequest=[nsurlrequest requestwithurl:appdelegate.url1//i declare  url @ appdelegate.m reasons...                                                   cachepolicy:nsurlrequestuseprotocolcachepolicy                                               timeoutinterval:60.0];       nsdata *returndata = [nsurlconnection sendsynchronousrequest:therequest                            returningresponse:nil error:nil];        nsstring *listfile = [[nsstring alloc] initwithdata:returndata encoding:nsasciistringencoding];                  self.array = [listfile propertylist];//i parse data array tablecview 

and how parse title tableview1 tableview2

- (void)tableview:(uitableview *)tableview accessorybuttontappedforrowwithindexpath:(nsindexpath *)indexpath {      tableview2 *tb2 = [[tableview2 alloc]init];     tb2.modaltransitionstyle = uimodaltransitionstylefliphorizontal;     tb2.title = [[[array objectatindex:indexpath.row] valueforkey:@"name"]description];     [self.navigationcontroller pushviewcontroller:tb2 animated:yes];   } 

any ideas ?

well ...if can answer or give me direction appreciate

great reply , answers !!!

oh...one more thing,i can use asihttprequest post data

but don't know how data after post ...?(is ?)

assuming have string want append appdelegate.url1 declared as:

nsstring *stringtoappend = @"whatever"; 

then can produce string containing new url:

nsstring *newurlasstring = [nsstring stringwithformat:@"%@%@",[appdelegate.url1 absolutestring],stringtoappend]; 

and nsurl string:

nsurl *newurl = [nsurl urlwithstring:newurlasstring]; 

and nsurlrequest that:

nsurlrequest *therequest=[nsurlrequest requestwithurl:newurl                                        cachepolicy:nsurlrequestuseprotocolcachepolicy                                        timeoutinterval:60.0]; 

Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -