誰能告訴我如何添加兩個標籤,但我仍然在UITableView的Cell.i增加了一個圖已經創建了一個視圖的UIView一些name.and我已經創建了UIView類兩個標籤和還設置標籤框架,設置文本等。我的問題是在桌面單元中獲取該視圖,但不是那些標籤。添加標籤作爲子視圖的UIView
countLabel.text = @"4";
countLabel.frame=CGRectMake(275, 10, 20, 15);
countLabel.font=[UIFont boldSystemFontOfSize:15.0];
countLabel.textColor=[UIColor colorWithWhite:0.0 alpha:0.5];
countLabel.backgroundColor=[UIColor clearColor];
hrsLabel.text = @"Hours";
hrsLabel.frame=CGRectMake(260, 30, 45, 15);
hrsLabel.font=[UIFont boldSystemFontOfSize:15.0];
hrsLabel.textColor=[UIColor colorWithWhite:0.0 alpha:0.5];
hrsLabel.backgroundColor=[UIColor clearColor];
這僅僅是我設置框,文本像標籤在UIView.and
GreenView *greenView = [[GreenView alloc] initWithFrame:CGRectMake(250, 8, 60, 50)];
greenView.backgroundColor = [UIColor colorWithRed:0.000 green:0.690 blue:0.313 alpha:0.5];
[cell.contentView addSubview:greenView];
我在這裏補充說UIView的一個實現代碼如下cell.and我不知道如何將這些標籤添加到我的UIView。請幫幫我。
對不起,如果用英文任何錯誤。 任何人都請幫助我。 提前感謝。
你能分享你在哪裏添加標籤UIView的代碼? –
添加這些行, [self.contentView addSubview:countLabel]; [self.contentView addSubview:hrsLabel]; –
這段代碼是在單獨的單元類中嗎?如果是這樣,你需要分配標籤。 –