我试图将数据从UITableViewCell传递到PopUp视图,我正在使用此代码在弹出视图中传递数据

时间:2015-10-20 06:00:09

标签: ios iphone

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
     STPopupController *popupController = [[STPopupController alloc] initWithRootViewController:[[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"SecondViewController"]];

    popupController.cornerRadius = 4;
    [popupController presentInViewController:self];


    [self.navigationController pushViewController:popupController animated:YES];

    popupController.marray1=[NSMutableArray arrayWithObject:[self.first objectAtIndex:indexPath.row]];
    popupController.marray2=[NSMutableArray arrayWithObject:[self.second objectAtIndex:indexPath.row]];
    popupController.marray3=[NSMutableArray arrayWithObject:[self.third objectAtIndex:indexPath.row]];

    NSLog(@"%@",[NSMutableArray arrayWithObject:[self.first objectAtIndex:indexPath.row]]);

}

1 个答案:

答案 0 :(得分:0)

首先设置DataValues,然后按屏幕。

希望这能解决您的问题。

> Try this code

    -(void)answerCode
{
    NSError * error ;
    NSURLResponse * urlResponse;

    NSURL * postUrl =[NSURL URLWithString:YourUrl];//enter your url

//your body here 
NSString * body =[NSString stringWithFormat:@"email=dharasis"];



    NSMutableURLRequest * request =[[NSMutableURLRequest alloc]initWithURL:postUrl cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:50];
    [request setHTTPMethod:@"POST"];
    [request setHTTPBody:[body dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES]];

    NSData * data =[NSURLConnection sendSynchronousRequest:request returningResponse:&urlResponse error:&error];
    if (!data) {

        return;
    }

    id json =[NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:&error];

  NSLog(@"Json result is:%@",josn);

}