Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>tableView1.m:</p> <pre><code>- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:YES]; } - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([[segue identifier] isEqualToString:@"showDetail"]) { NSIndexPath *indexPath = [myTable indexPathForSelectedRow]; NSDictionary *item = [displayItems objectAtIndex:[indexPath row]]; [[segue destinationViewController] setDetailItem:item]; } } </code></pre> <p>tableView2.h:</p> <pre><code>@property (strong, nonatomic) id detailItem; </code></pre> <p>tableView2.m:</p> <pre><code>- (void)setDetailItem:(id)newDetailItem { if (_detailItem != newDetailItem) { _detailItem = newDetailItem; // Update the view. [self configureView]; } } - (void)configureView { if (self.detailItem) { itemID = self.detailItem; [self getCourse]; } } - (void)getCourse{ NSString *code = [NSString stringWithFormat:@"user=%@", itemID]; NSData *postData = [code dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]; NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]]; NSURL *url = [NSURL URLWithString:@"http://localhost/getUser.php"]; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; [request setHTTPMethod:@"POST"]; [request setValue:postLength forHTTPHeaderField:@"Content-Length"]; [request setHTTPBody:postData]; NSURLResponse *response; NSError *error; NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&amp;response error:&amp;error]; allCourseArray = [NSJSONSerialization JSONObjectWithData:responseData options:kNilOptions error:&amp;error]; NSDictionary *item = [allCourseArray objectAtIndex:0]; NSString *courseName = [item objectForKey:@"courseName"]; NSString *courseCode = [item objectForKey:@"courseCode"]; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload