自定义的UITableViewCell 不能响应事件
情况是这样的,我自定义了一个UITableViewCell,显示数据什么的都一切正常,但是单击cell的时候一直push到下一个页面,我用的是storyboard,按理连个线就行了但是还是传不下去,UITableViewDelegate, UITableViewDataSource必须的方法也已经实现了,头痛啊,求大虾指点~急死~cell.h
#import <UIKit/UIKit.h>
@interface Cell : UITableViewCell
//interfaces for the xib
@property (copy, nonatomic) UIImage *image;
@property (copy, nonatomic) NSString *title;
@property (copy, nonatomic) NSString *address;
@property (copy, nonatomic) NSString *time;
@property (copy, nonatomic) NSString *collect;
//label outlet
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UILabel *addressLabel;
@property (weak, nonatomic) IBOutlet UILabel *timeLabel;
@property (weak, nonatomic) IBOutlet UILabel *collectLabel;
@property (weak, nonatomic) IBOutlet UIImageView *img;
@end
cell.m
#import "Cell.h"cell --------------------编程问答-------------------- 。。。不是 你想点击的Cell的时候做什么
@implementation Cell
@synthesize title;
@synthesize address;
@synthesize time;
@synthesize collect;
@synthesize image;
- (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
}
//重写set函数,给每个label赋值
-(void)setTitle:(NSString *)n {
if (![n isEqualToString:title]) {
title = [n copy];
self.titleLabel.text = title;
}
}
-(void)setAddress:(NSString *)d{
if (![d isEqualToString:address]) {
address = [d copy];
self.addressLabel.text = address;
}
}
-(void)setTime:(NSString *)a{
if (![a isEqualToString:time]) {
time = [a copy];
self.timeLabel.text = time;
}
}
-(void)setCollect:(NSString *)e{
if(![e isEqualToString:collect]){
collect = [e copy];
self.collectLabel.text = collect;
}
}
-(void)setImage:(UIImage *)a{
if (![a isEqual:image]) {
image = [a copy];
self.img.image = image;
}
}
@end
补充:移动开发 , iPhone