Click a row in TableView to go to the next page. Click tableview.
The TableView control is very common in iOS development. It can better display a hierarchical structure. This section describes how to jump to the next page when you click an entry. The following is an official process about how to implement this jump and how to transmit data.
Storyboards make it easy to pass data from one scene to another via the prepareForSegue:sender: method of the UIViewController class. This method is called when the first scene (the source) is about to transition to the next scene (the destination). The source view controller can implement prepareForSegue:sender: to perform setup tasks, such as passing information to the destination view controller about what it should display in its table view. Listing 3-1 shows one implementation of this method.
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{if ([[segue identifier] isEqualToString:@"ShowDetails"]) { MyDetailViewController *detailViewController = [segue destinationViewController]; NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow]; detailViewController.data = [self.dataControllerobjectInListAtIndex:indexPath.row];} }
A segue represents a one-way transition from a source scene to a destination scene. One of the consequences of this design is that you can use a segue to pass data to a destination, but you can’t use a segue to send data from a destination to its source. To solve this problem, you create a delegate protocol that declares methods that the destination view controller calls when it needs to pass back some data.
In iphone development, tableviewcell pushes a page using segue. How can I perform other operations without redirecting when I click the first line?
Rewrite this method:
-(Void) tableView :( UITableView *) tableView didSelectRowAtIndexPath :( NSIndexPath *) indexPath
{} Can achieve the corresponding jump, call [self. navigationController pushViewController: ViewController animated: YES]; this method is enough
If you want to use segue:
-(Void) prepareForSegue :( UIStoryboardSegue *) segue sender :( id) sender
This sender is the event source, UITableViewCell * cell = (id) sender;
If ([cell reuseIdentifier] = @ "first ")
....
You need to set CellIdentifier of the first cell independently in cellForRowAtIndexPath, and then judge whether it is the first cell.
In tableView, how does one switch the focus by clicking a key on the keyboard for multiple textfields?
Switching focus is actually to change this TextField to the first response.