0
我試圖在自定義UITableViewCells內添加視圖。我嘗試使用[cell.contentView addSubview]方法,但視圖不出現。我必須做什麼。由於在單元格內添加子視圖
我試圖在自定義UITableViewCells內添加視圖。我嘗試使用[cell.contentView addSubview]方法,但視圖不出現。我必須做什麼。由於在單元格內添加子視圖
如果您正在使用然後自定義單元格去你的自定義單元格類...
UIView *contentView;
contentView =[[UIView alloc]init];
然後設置您的視圖幀...
終於
[self.contentView addSubview:contentView];
你能告訴您用於創建子視圖的代碼是否在將其添加到contentView之前正確創建? – wuf810 2011-05-22 11:27:14
「[cell.contentView addSubview:subview];」應該可以工作,我想我們需要更多的信息或代碼來幫助你完成這個任務。 – JulenissensHjelper 2011-05-22 11:28:01
這是我在自定義單元格類中的代碼: UIView * view = [[[UIView alloc] init] autorelease]; view.frame = CGRectMake(20,20,20,48); [self.soundview addSubview:tmpView]; – user591375 2011-05-22 19:20:35