Iphone 在didSelectRowAtIndexPath+;上添加uiimageview和uilabel;uiTableview
我想在选中的行中添加uiimageview和uilabel。 现在,当我选择表中的行时Iphone 在didSelectRowAtIndexPath+;上添加uiimageview和uilabel;uiTableview,iphone,uitableview,Iphone,Uitableview,我想在选中的行中添加uiimageview和uilabel。 现在,当我选择表中的行时 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { // Deselect cell static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequ
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// Deselect cell
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
> tableView deselectRowAtIndexPath:indexPath animated:TRUE];
if (indexPath.row == 0) {
imageView1 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"AboutImage.png"]];
imageView1.center = CGPointMake(310, 48);
[cell.contentView addSubview:imageView1];
[imageView1 release];
imageView2 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"AboutImage.png"]];
imageView2.center = CGPointMake(310, 48);
[cell.contentView addSubview:imageView2];
[imageView2 release];
但这样做之后,imageview也不会出现。。
请任何人帮助我..如何将uiimageview和标签添加到单元格中
提前感谢您应该使用
[tableView cellForRowAtIndexPath:indexPath];
然后您可以在其上添加视图您应该使用
[tableView cellForRowAtIndexPath:indexPath];
然后,您可以在其上添加视图您需要添加以下代码:-
cell = [self.tableView cellForRowAtIndexpath];
您需要添加以下代码:-
cell = [self.tableView cellForRowAtIndexpath];
您没有为imageview设置帧,我认为这就是问题所在。所以试试这个 设为
imageView1.frame = CGRectMake();
根据您的要求设置帧…您还没有为imageview设置帧,我认为这就是问题所在。所以试试这个 设为
imageView1.frame = CGRectMake();
根据您的要求设置框架