情况是这样的,我自定义了一个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;
@endcell.m
#import "Cell.h"@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
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;
@endcell.m
#import "Cell.h"@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
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货