Master View Application : How to send a predefined text based on selecting
a tableview to detailview
Currently, when I click on an item in the tableview, I am redirected to
detailview. But I do not know how to retrieve and send messge
With this, I get the selection of tableview and I created a message.
-(void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
LoanModel* loan = _feed.users[indexPath.row];
NSString* message = [NSString stringWithFormat:@"%@ from %@ needs a loan %@",
loan.name, loan.username, loan.email
];
}
But how can i send this message to detailview and display it ?
Here is my detailview h
// ssDetailViewController.h
#import <UIKit/UIKit.h>
@interface ssDetailViewController : UIViewController
@property (strong, nonatomic) id detailItem;
@property (weak, nonatomic) IBOutlet UILabel *detailDescriptionLabel;
@end
Here is my detailview m
// ssDetailViewController.m
#import "ssDetailViewController.h"
@interface ssDetailViewController ()
- (void)configureView;
@end
@implementation ssDetailViewController
#pragma mark - Managing the detail item
- (void)setDetailItem:(id)newDetailItem
{
if (_detailItem != newDetailItem) {
_detailItem = newDetailItem;
// Update the view.
[self configureView];
}
}
- (void)configureView
{
// Update the user interface for the detail item.
if (self.detailItem) {
self.detailDescriptionLabel.text = [self.detailItem description];
}
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
[self configureView];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
No comments:
Post a Comment