Mam niestandardowy UITableViewCell, o nazwie EventCell
.Niestandardowe UITableViewCell nie wywoływanie prepareForSegue
EventCell.h
#import <UIKit/UIKit.h>
@interface EventCell : UITableViewCell
@property (nonatomic, strong) IBOutlet UILabel *titleLabel;
@property (nonatomic, strong) IBOutlet UILabel *locationLabel;
@property (nonatomic, strong) IBOutlet UILabel *dateLabel;
@property (nonatomic, strong) IBOutlet UILabel *typeLabel;
@end
EventCell.m
#import "EventCell.h"
@implementation EventCell
@synthesize titleLabel, locationLabel, dateLabel, typeLabel;
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
// Initialization code
}
return self;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
Oto jak ja skonfigurowaniu komórki.
EventsMasterViewController.m
- (EventCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
Event *myEvent;
NSString *CellIdentifier = @"EventCell";
EventCell *cell = (EventCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"EventCell" owner:nil options:nil];
for (id currentObject in topLevelObjects)
{
if ([currentObject isKindOfClass:[EventCell class]])
{
cell = (EventCell *)currentObject;
break;
}
}
myEvent = [self.myEventsDataController objectInListAtIndex:indexPath.row];
cell.titleLabel.text = myEvent.name;
cell.locationLabel.text = myEvent.location;
cell.typeLabel.text = @"Social";
cell.layer.borderColor = [UIColor blackColor].CGColor;
cell.layer.borderWidth = 1.0;
return cell;
}
komórka jest sformatowana wielki, wygląda dokładnie tak, jak ja potrzebuję go. Ale po kliknięciu na nią komórka podświetla się na niebiesko i nie przenosi się do następnego widoku. Umieściłem punkt przerwania w metodzie prepareForSegue i nie jest on nawet wywoływany.
Czy istnieje sposób ręcznego wywołania metody prepareForSegue? Jeśli tak, to gdzie mam to zrobić.
Co z twoją 'tableView: didSelectRowAtIndexPath:'? – Desdenova
Nie mam metody o nazwie, czy muszę to zaimplementować? – ardavis
Z tego, co czytam, nie używamy 'prepareForSegue' zamiast' didSelectRowAtIndexPath'? – ardavis