【发布时间】:2016-02-04 09:00:54
【问题描述】:
我目前在 UITableView 上面添加 UIView。它可以工作,但看起来像空的 UITableViewCell 如下所示:
有我的第二个视图的代码(.m 文件):
-(id)initWithFrame:(CGRect)frame{
self = [super initWithFrame:frame];
NSLog(@"Calld");
self.backgroundColor = [UIColor whiteColor];
[self addLabel];
return self;
}
-(void)addLabel{
UILabel *fromLabel = [[UILabel alloc]initWithFrame:CGRectMake(8, 220, 304, 128)];
fromLabel.text = @"( Щелкните на экран, чтобы добавить задачи )";
fromLabel.numberOfLines = 3;
fromLabel.baselineAdjustment = UIBaselineAdjustmentAlignBaselines; // or UIBaselineAdjustmentAlignCenters, or UIBaselineAdjustmentNone
fromLabel.adjustsFontSizeToFitWidth = YES;
fromLabel.adjustsLetterSpacingToFitWidth = YES;
fromLabel.minimumScaleFactor = 10.0f/12.0f;
fromLabel.clipsToBounds = YES;
fromLabel.backgroundColor = [UIColor clearColor];
fromLabel.textColor = [UIColor blackColor];
fromLabel.textAlignment = NSTextAlignmentLeft;
[self addSubview:fromLabel];
}
还有主视图:
InitialView *initView = [[InitialView alloc]initWithFrame:[[UIScreen mainScreen] bounds]];
[self.view addSubview:initView];
如何删除空行,然后再次删除视图和显示表?
【问题讨论】:
标签: ios objective-c iphone uitableview uiview