我在tableview
中有两个自定义单元格正在推送到另一个viewController,而另一个是另一个viewController的模态。一旦我点击第二个单元格,模态到viewController没有任何反应,但如果我再次点击屏幕上的任何地方模态viewController来了。
我在没有编码的情况下启用了故事板中的单元格。那么请问我的问题在哪里?
CustomCell代码:
小时。
@interface CustomCellAboutUs : UITableViewCell
@property (weak, nonatomic) IBOutlet UILabel *AboutUsLbl;
@end
微米。
#import "CustomCellAboutUs.h"
@implementation CustomCellAboutUs
- (void)awakeFromNib {
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
}
@end
MainView控制器:
微米。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
if( indexPath.row == 0 ) {
CustomCell01 *customCellimg = [tableView dequeueReusableCellWithIdentifier:@"CustomCell01"];
customCellimg.imageView.image = [UIImage imageNamed:@"Logo.png"];
customCellimg.selectionStyle = UITableViewCellSelectionStyleNone;
return customCellimg;
}
else if (indexPath.row == 4) {
CustomCellAboutUs *customCellAboutUs = [tableView dequeueReusableCellWithIdentifier:@"CustomCellAboutUs"];
customCellAboutUs.selectionStyle = UITableViewCellSelectionStyleNone;
customCellAboutUs.backgroundView = [[UIImageView alloc] initWithImage:[ [UIImage imageNamed:@"nudeSideBarEmpty.png"] stretchableImageWithLeftCapWidth:0.0 topCapHeight:5.0] ];
customCellAboutUs.AboutUsLbl.text = @"About Us";
return customCellAboutUs;
}
else {
CustomCell0 *customCell = [tableView dequeueReusableCellWithIdentifier:@"CustomCell0"];
customCell.lblSlide.text = [searchArray objectAtIndex:indexPath.row];
tableView.backgroundColor = [UIColor colorWithPatternImage: [UIImage imageNamed: @"nudeSideBarEmpty.png"]]; //set image for UITableView
customCell.backgroundView = [[UIImageView alloc] initWithImage:[ [UIImage imageNamed:@"nudeSideBarEmpty.png"] stretchableImageWithLeftCapWidth:0.0 topCapHeight:5.0] ];
customCell.selectionStyle = UITableViewCellSelectionStyleNone;
return customCell;
}
}
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
NSIndexPath *indexPath = [_tbl1 indexPathForCell:sender];
static NSString *simpleTableIdentifier = @"CustomCell0";
CustomCell0 *customCell = [_tbl1 dequeueReusableCellWithIdentifier:simpleTableIdentifier];
customCell.lblSlide.text = [searchArray objectAtIndex:indexPath.row];
NSString *newString = [customCell.lblSlide.text stringByReplacingOccurrencesOfString:@" -" withString:@""];
if ([segue.identifier isEqualToString:@"TESTTEST"]) {
UINavigationController *navController = segue.destinationViewController;
ViewController *destViewController = [navController childViewControllers].firstObject;
destViewController.str1 = str;
destViewController.subjectNameSupplier = newString;
}
}