Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 自定义UITableViewCell';s的内容未显示_Ios_Objective C_Uitableview - Fatal编程技术网

Ios 自定义UITableViewCell';s的内容未显示

Ios 自定义UITableViewCell';s的内容未显示,ios,objective-c,uitableview,Ios,Objective C,Uitableview,我正在尝试创建自定义视图单元格。但是它没有显示出来。tableview单元格的创建编号正确,但未显示其内容 VDCoreTableViewCell.h @interface VDCoreTableViewCell : UITableViewCell @property (weak, nonatomic) UIImageView *cell_image; @property (strong, nonatomic) UILabel *title; @property (weak, nonatom

我正在尝试创建自定义视图单元格。但是它没有显示出来。tableview单元格的创建编号正确,但未显示其内容

VDCoreTableViewCell.h

@interface VDCoreTableViewCell : UITableViewCell
@property (weak, nonatomic)  UIImageView *cell_image;
@property (strong, nonatomic)  UILabel *title;
@property (weak, nonatomic)  UILabel *subTitle;
VDCoreTableViewCell.m

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.title = [[UILabel alloc] initWithFrame:self.bounds];

        CAGradientLayer *gradientLayer = [CAGradientLayer layer];
        gradientLayer.frame = self.title.bounds;
        gradientLayer.colors = [NSArray arrayWithObjects:(id)[[UIColor whiteColor]CGColor], (id)[[UIColor blackColor]CGColor], nil];
        [self.title.layer insertSublayer:gradientLayer atIndex:0];
    }
return self;
}
VDViewController.h

 @interface VDViewController : VDCoreViewController <UITableViewDelegate, UITableViewDataSource>
 @property (strong, nonatomic)  UITableView *tableView;
 @end

请帮忙。

您必须将
标题标签添加到您的手机中

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
   if (self) {
    self.title = [[UILabel alloc] initWithFrame:self.bounds];

    CAGradientLayer *gradientLayer = [CAGradientLayer layer];
    gradientLayer.frame = self.title.bounds;
    gradientLayer.colors = [NSArray arrayWithObjects:(id)[[UIColor whiteColor]CGColor], (id)[[UIColor blackColor]CGColor], nil];
    [self.title.layer insertSublayer:gradientLayer atIndex:0];
    [self.contentView addSubview:self.title]; //Add your label what you have created to content view
  }
  return self;
}

先生,Cellatroh在哪里
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
   if (self) {
    self.title = [[UILabel alloc] initWithFrame:self.bounds];

    CAGradientLayer *gradientLayer = [CAGradientLayer layer];
    gradientLayer.frame = self.title.bounds;
    gradientLayer.colors = [NSArray arrayWithObjects:(id)[[UIColor whiteColor]CGColor], (id)[[UIColor blackColor]CGColor], nil];
    [self.title.layer insertSublayer:gradientLayer atIndex:0];
    [self.contentView addSubview:self.title]; //Add your label what you have created to content view
  }
  return self;
}