I am new to xcode kindly help me to correct the error my code is below,
-(void)XYZ:(NSString *)id1
{
id2 = [id1 intValue];
[self Vehicles:id2];
}
-(NSArray *)Vehicles:(NSInteger) id2
{
NSString *urlString=[NSString stringWithFormat:@"http://www.xxxx.com/xxxx/vehiclelist.php?uid=%d&format=json",id2];
NSURL *url=[NSURL URLWithString:urlString];
NSData *data=[NSData dataWithContentsOfURL:url];
NSError *error;
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&error];
NSArray *results = [json valueForKey:@"posts"];
return results;
}
And i pass the id value from the login vied controller the code is,
if(stat!=0&&id2!=0&&[Username length]!=0&&[Password length]!=0)
{
Services *loc = [[Services alloc] initWithNibName:@"Services" bundle:nil];
loc.modalPresentationStyle = UIModalPresentationCurrentContext;
loc.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self presentViewController:loc animated:YES completion:Nil];
MyVchicle *about = [[MyVchicle alloc] initWithNibName:@"MyVchicle" bundle:nil];
about.modalPresentationStyle = UIModalPresentationCurrentContext;
about.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self presentViewController:about animated:YES completion:Nil];
[loc XYZ:id1];
}
Thanks in advance.
For sending data from one ViewController to another, follow these steps :
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { DestinationViewController *destController = [segue destinationViewController]; destController.varName = @"passThisValue"; }
This should get you going. Hope this helps.
You can refer to this link.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.