// // AlternativeSplitViewController.h // AlternativeSplit // #import <UIKit/UIKit.h> @ class MasterViewController; @ interface AlternativeSplitViewController : UIViewController { IBOutlet MasterViewController* masterViewController; } @end * This source code was highlighted with Source Code Highlighter .
// // AlternativeSplitViewController.h // AlternativeSplit // #import <UIKit/UIKit.h> @ class MasterViewController; @ interface AlternativeSplitViewController : UIViewController { IBOutlet MasterViewController* masterViewController; } @end * This source code was highlighted with Source Code Highlighter .
// // AlternativeSplitViewController.h // AlternativeSplit // #import <UIKit/UIKit.h> @ class MasterViewController; @ interface AlternativeSplitViewController : UIViewController { IBOutlet MasterViewController* masterViewController; } @end * This source code was highlighted with Source Code Highlighter .
// // AlternativeSplitViewController.h // AlternativeSplit // #import <UIKit/UIKit.h> @ class MasterViewController; @ interface AlternativeSplitViewController : UIViewController { IBOutlet MasterViewController* masterViewController; } @end * This source code was highlighted with Source Code Highlighter .
// // AlternativeSplitViewController.h // AlternativeSplit // #import <UIKit/UIKit.h> @ class MasterViewController; @ interface AlternativeSplitViewController : UIViewController { IBOutlet MasterViewController* masterViewController; } @end * This source code was highlighted with Source Code Highlighter .
// // AlternativeSplitViewController.h // AlternativeSplit // #import <UIKit/UIKit.h> @ class MasterViewController; @ interface AlternativeSplitViewController : UIViewController { IBOutlet MasterViewController* masterViewController; } @end * This source code was highlighted with Source Code Highlighter .
// // AlternativeSplitViewController.h // AlternativeSplit // #import <UIKit/UIKit.h> @ class MasterViewController; @ interface AlternativeSplitViewController : UIViewController { IBOutlet MasterViewController* masterViewController; } @end * This source code was highlighted with Source Code Highlighter .
// // AlternativeSplitViewController.h // AlternativeSplit // #import <UIKit/UIKit.h> @ class MasterViewController; @ interface AlternativeSplitViewController : UIViewController { IBOutlet MasterViewController* masterViewController; } @end * This source code was highlighted with Source Code Highlighter .
// // AlternativeSplitViewController.h // AlternativeSplit // #import <UIKit/UIKit.h> @ class MasterViewController; @ interface AlternativeSplitViewController : UIViewController { IBOutlet MasterViewController* masterViewController; } @end * This source code was highlighted with Source Code Highlighter .
// // AlternativeSplitViewController.h // AlternativeSplit // #import <UIKit/UIKit.h> @ class MasterViewController; @ interface AlternativeSplitViewController : UIViewController { IBOutlet MasterViewController* masterViewController; } @end * This source code was highlighted with Source Code Highlighter .
// // AlternativeSplitViewController.h // AlternativeSplit // #import <UIKit/UIKit.h> @ class MasterViewController; @ interface AlternativeSplitViewController : UIViewController { IBOutlet MasterViewController* masterViewController; } @end * This source code was highlighted with Source Code Highlighter .
// // AlternativeSplitViewController.h // AlternativeSplit // #import <UIKit/UIKit.h> @ class MasterViewController; @ interface AlternativeSplitViewController : UIViewController { IBOutlet MasterViewController* masterViewController; } @end * This source code was highlighted with Source Code Highlighter .
* This source code was highlighted with Source Code Highlighter .
- //
- // MasterViewController.h
- // AlternativeSplit
- //
- #import <UIKit / UIKit.h>
- @ class DetailViewController;
- @ interface MasterViewController: UITableViewController {
- IBOutlet DetailViewController * detailViewController;
- }
- @end
* This source code was highlighted with Source Code Highlighter .
- //
- // MasterViewController.m
- // AlternativeSplit
- //
- #import "MasterViewController.h"
- #import "DetailViewController.h"
- @implementation MasterViewController
- #pragma mark -
- #pragma mark View lifecycle
- - (BOOL) shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation) interfaceOrientation {
- // Override to allow orientations.
- return YES;
- }
- #pragma mark -
- #pragma mark Table view data source
- - (NSInteger) numberOfSectionsInTableView: (UITableView *) tableView {
- // Return the number of sections.
- return 1;
- }
- - (NSInteger) tableView: (UITableView *) tableView numberOfRowsInSection: (NSInteger) section {
- // Return the number of rows in the section.
- return 5;
- }
- // Customize the appearance of the table view cells.
- - (UITableViewCell *) tableView: (UITableView *) tableView cellForRowAtIndexPath: (NSIndexPath *) indexPath {
- static NSString * CellIdentifier = @ "Cell" ;
- UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier: CellIdentifier];
- if (cell == nil) {
- cell = [[[UITableViewCell alloc] initWithStyle: UITableViewCellStyleDefault reuseIdentifier: CellIdentifier] autorelease];
- }
- // Configure the cell ...
- cell.textLabel.text = [NSString stringWithFormat: @ "Row% i" , indexPath.row];
- return cell;
- }
- #pragma mark -
- #pragma mark Table view delegate
- - ( void ) tableView: (UITableView *) tableView didSelectRowAtIndexPath: (NSIndexPath *) indexPath {
- [detailViewController setNewText: [NSString stringWithFormat: @ "Row% i" , indexPath.row]];
- }
- #pragma mark -
- #pragma mark Memory management
- - ( void ) didReceiveMemoryWarning {
- // Releases the view if it doesn't have a superview.
- [super didReceiveMemoryWarning];
- // Relinquish ownership any cached data, images, etc that are not use.
- }
- - ( void ) dealloc {
- [super dealloc];
- }
- @end
* This source code was highlighted with Source Code Highlighter .
- //
- // DetailViewController.h
- // AlternativeSplit
- //
- #import <UIKit / UIKit.h>
- @ interface DetailViewController: UIViewController {
- IBOutlet UILabel * lbl;
- }
- - ( void ) setNewText: (NSString *) text;
- @end
* This source code was highlighted with <a href="http://virtser.net/blog/post/source-code-highlighter.aspx"> Source Code Highlighter .
- //
- // DetailViewController.m
- // AlternativeSplit
- //
- #import "DetailViewController.h"
- @implementation DetailViewController
- - ( void ) setNewText: (NSString *) text {
- lbl.text = text;
- }
- - (BOOL) shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation) interfaceOrientation {
- // Overriden to allow any orientation.
- return YES;
- }
- - ( void ) didReceiveMemoryWarning {
- // Releases the view if it doesn't have a superview.
- [super didReceiveMemoryWarning];
- // Release any cached data, images, etc that are not in use.
- }
- - ( void ) viewDidUnload {
- [super viewDidUnload];
- // Release any retained subviews of the main view.
- // eg self.myOutlet = nil;
- }
- - ( void ) dealloc {
- [super dealloc];
- }
- @end
Source: https://habr.com/ru/post/91366/
All Articles