This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface PCLeadViewController () | |
@property (weak, nonatomic) IBOutlet UILabel *nameLabel; | |
@property (weak, nonatomic) IBOutlet UILabel *surnameLabel; | |
@property (weak, nonatomic) IBOutlet UILabel *companyLabel; | |
@end | |
- (void)viewDidLoad { | |
[super viewDidLoad]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface PCLeadViewController () | |
@property (weak, nonatomic) IBOutlet UILabel *nameLabel; | |
@property (weak, nonatomic) IBOutlet UILabel *surnameLabel; | |
@property (weak, nonatomic) IBOutlet UILabel *companyLabel; | |
@property (strong, nonatomic) IBOutletCollection(UILabel) NSArray *captionLabels; | |
@property (strong, nonatomic) IBOutletCollection(UILabel) NSArray *labels; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { | |
return 7; | |
} | |
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { | |
static NSString *CellIdentifier = @"LeadCell"; | |
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; | |
return cell; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface PCLead : NSObject | |
@property NSString *name; | |
@property NSString *surname; | |
@property NSString *company; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface PCLeadCell () | |
@property (weak, nonatomic) IBOutlet UILabel *nameLabel; | |
@property (weak, nonatomic) IBOutlet UILabel *companyLabel; | |
@end | |
@implementation PCLeadCell | |
- (void)setLead:(PCLead *)lead { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface PCLeadsViewController () | |
@property NSArray *leads; | |
@end | |
@implementation PCLeadsViewController | |
- (void)viewDidLoad { | |
[super viewDidLoad]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { | |
PCLeadViewController *leadViewController = segue.destinationViewController; | |
NSIndexPath *selectedRowIndexPath = [self.tableView indexPathForSelectedRow]; | |
leadViewController.lead = self.leads[selectedRowIndexPath.row]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Header file | |
@interface PCPersistentStack : NSObject | |
@property (readonly) NSManagedObjectContext *managedObjectContext; | |
- (instancetype)initWithStoreURL:(NSURL*)storeURL modelURL:(NSURL*)modelURL; | |
- (void)saveContext; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface PCAppDelegate () | |
@property PCPersistentStack *persistentStack; | |
@end | |
@implementation PCAppDelegate | |
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | |
self.persistentStack = [[PCPersistentStack alloc] initWithStoreURL:[self storeURL] modelURL:[self modelURL]]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@implementation PCLead | |
@dynamic name; | |
@dynamic surname; | |
@dynamic company; | |
+ (instancetype)insertLeadInManagedObjectContext:(NSManagedObjectContext *)managedObjectContext { | |
return [NSEntityDescription insertNewObjectForEntityForName:self.entityName inManagedObjectContext:managedObjectContext]; | |
} |
OlderNewer