0

我正在寻找一种将输入数据库的数据从一个视图传输到另一个视图的方法。我有一个插入大学考试的表格视图控制器,每次考试都必须显示你的卡,从数据浏览器调用它的数据来解析当前用户

- (void) prepareForSegue: (uistoryboardSegue)
4

1 回答 1

0

然后我尽量解释清楚......

我从项目 parse.com PFQueryTableViewController 下载。我输入了所有数据,完美地回忆了 Databrowser ...我的单元格由此创建:

#import "TableViewParse.h"
#import "CustomNav.h"
#import "ListaInAttesa.h"

@implementation TableViewParse
@synthesize TableViewInAttesa;



- (id)initWithCoder:(NSCoder *)aCoder {
    self = [super initWithCoder:aCoder];




        // Custom the table

        // The className to query on
        self.parseClassName = @"miaclasse";

        // The key of the PFObject to display in the label of the default cell style
        self.textKey = @"titolomio";


        // Whether the built-in pull-to-refresh is enabled
        self.pullToRefreshEnabled = YES;

        // Whether the built-in pagination is enabled
        self.paginationEnabled = YES;

        // The number of objects to show per page
        self.objectsPerPage = 5;

     [CustomNav NavBar];

    return self;
}
- (void)viewDidLoad
{
    [super viewDidLoad];



    // Uncomment the following line to preserve selection between presentations.

    self.clearsSelectionOnViewWillAppear = NO;

    // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
    self.navigationItem.rightBarButtonItem = self.editButtonItem;
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
}

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
}

- (void)viewDidDisappear:(BOOL)animated
{
    [super viewDidDisappear:animated];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];

    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - Parse

- (void)objectsDidLoad:(NSError *)error {
    [super objectsDidLoad:error];

    // This method is called every time objects are loaded from Parse via the PFQuery
}

- (void)objectsWillLoad {
    [super objectsWillLoad];

    // This method is called before a PFQuery is fired to get more objects
}


// Override to customize what kind of query to perform on the class. The default is to query for
// all objects ordered by createdAt descending.
- (PFQuery *)queryForTable {
    PFQuery *query = [PFQuery queryWithClassName:self.parseClassName];
        [query whereKey: @"user" equalTo: [PFUser currentUser]];

    // If no objects are loaded in memory, we look to the cache first to fill the table
    // and then subsequently do a query against the network.
    if ([self.objects count] == 0) {
        query.cachePolicy = kPFCachePolicyCacheThenNetwork;
    }
    [query orderByAscending:@"createdAt"];

    return query;
}




// Override to customize the look of a cell representing an object. The default is to display
// a UITableViewCellStyleDefault style cell with the label being the first key in the object.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath object:(PFObject *)object {
    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
    }

    // Configure the cell
    cell.textLabel.text = [object objectForKey:@"titolomio"];
    cell.detailTextLabel.text = [NSString stringWithFormat:@"Questo esame è previsto per il : %@", [object objectForKey:@"datamia"]];

    return cell;
}


/*
 // Override if you need to change the ordering of objects in the table.
 - (PFObject *)objectAtIndex:(NSIndexPath *)indexPath {
 return [objects objectAtIndex:indexPath.row];
 }
 */


// Override to customize the look of the cell that allows the user to load the next page of objects.
// The default implementation is a UITableViewCellStyleDefault cell with simple labels.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForNextPageAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *CellIdentifier = @"NextPage";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
    }


    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    cell.textLabel.text = @"Visualizza ancora ....";

    return cell;
}


#pragma mark - Table view data source


// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
    // Return NO if you do not want the specified item to be editable.
    return YES;
}



// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
    if (editingStyle == UITableViewCellEditingStyleDelete) {

        PFObject *object = [self.objects objectAtIndex:indexPath.row];
        [object deleteInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
            [self loadObjects];
        }];
    }
}



// Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath
{
}



// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath
{
    // Return NO if you do not want the item to be re-orderable.
    return YES;
}




- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if ([segue.identifier isEqualToString:@"Esamiinattesa"])
    {
       // NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
       // ListaInAttesa *destViewController = segue.destinationViewController;
       // destViewController.title = [self.postController objectInListAtIndex:indexPath.row];
    }
}


#pragma mark - Table view delegate

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [super tableView:tableView didSelectRowAtIndexPath:indexPath];
   // [self performSegueWithIdentifier:@"Esamiinattesa" sender:indexPath];

}

@end

现在我需要当用户单击放置在单元格 Tableview 中的当前考试时,将其发送到特定的视图控制器,其中内部被称为考试结果用户选择当前的时间......

我知道这是“prepareForSegue”,但我不知道我错在哪里,也许我错了只是获得所需结果的程序。

PSI 刚刚意识到我与用户的 findanzato 建立了连接,因为我改变了我的电脑并且我一直在做相同的 id 注销......对不起......我们正在两个应用程序中处理这个项目

于 2013-08-03T17:53:37.460 回答