#import <UIKit/UIKit.h> @interface DetailViewController : UIViewController @property NSInteger bid; @property (strong, nonatomic) id detailItem; @property (strong, nonatomic) IBOutlet UILabel *detailDescriptionLabel; @property (strong, nonatomic) IBOutlet UITextView *textView; @end
#import "DetailViewController.h" @interface DetailViewController () - (void)configureView; @end @implementation DetailViewController @synthesize detailItem = _detailItem; @synthesize detailDescriptionLabel = _detailDescriptionLabel; @synthesize bid; @synthesize textView = _textView; #pragma mark - Managing the detail item
- (void)configureView { // Update the user interface for the detail item. if (self.detailItem) { self.detailDescriptionLabel.text = [self.detailItem description]; } }
- (void)configureView { self.detailDescriptionLabel.text = [NSString stringWithFormat:@"Detail: %d",bid]; }
#import "MasterViewController.h" #import "DetailViewController.h" @implementation MasterViewController
#pragma mark - View lifecycle - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. } -(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if([[segue identifier] isEqualToString:@"MySegue"]){ DetailViewController *vc =[segue destinationViewController]; NSIndexPath *indexPath =[self.tableView indexPathForSelectedRow]; NSInteger tagIndex = [indexPath row]; [vc setBid:tagIndex]; } }