0
我添加了一些名为* cellSeparator和其他UILabels的动态UIView ...现在发生什么时,我再次调用此代码,然后重写标签文本并覆盖之前创建的标签文本...我不是很了解这个IOS development.so谁能告诉我如何我可以再次动态创建之前删除此UIView的?东阳UIView的是动态创建的,我不知道如何删除的UIView如何删除动态创建的UIView和UILabel文本?
UILabel *indexLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, self.view.frame.size.height-150, self.view.frame.size.width/2,30)];
[indexLabel setBackgroundColor:[UIColor clearColor]];
indexLabel.textColor = [UIColor whiteColor];
indexLabel.text = @"Details:-";
indexLabel.font = [UIFont systemFontOfSize:20.00];
UILabel *tagLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, self.view.frame.size.height-120, self.view.frame.size.width/2, 30)];
tagLabel.backgroundColor = [UIColor clearColor];
NSLog(@"LOg %@",imageId);
NSLog(@"LOg %@",imageStyle);
NSLog(@"LOg %@",imageType);
NSLog(@"LOg %@",imageWeight);
tagLabel.text = [NSString stringWithFormat:@"The Id of Jewl Is: %@",imageId];
imageTypelabel= [[UILabel alloc] initWithFrame:CGRectMake(20, self.view.frame.size.height-90, self.view.frame.size.width/2, 30)];
imageTypelabel.backgroundColor = [UIColor clearColor];
imageTypelabel.text = [NSString stringWithFormat:@"The Type of Jewl Is: %@",imageType];
imageStylelabel = [[UILabel alloc] initWithFrame:CGRectMake(20, self.view.frame.size.height-60, self.view.frame.size.width/2, 30)];
imageTypelabel.backgroundColor = [UIColor clearColor];
imageStylelabel.text = [NSString stringWithFormat:@"The style of Jewl Is: %@",imageStyle];
imageWeightlabel = [[UILabel alloc] initWithFrame:CGRectMake(20, self.view.frame.size.height-30, self.view.frame.size.width/2, 30)];
imageStylelabel.backgroundColor = [UIColor clearColor];
imageWeightlabel.text = [NSString stringWithFormat:@"The weight of Jewl Is: %@",imageWeight];
imageWeightlabel.backgroundColor = [UIColor clearColor];
imageWeightlabel.textColor = [UIColor whiteColor];
imageTypelabel.textColor = [UIColor whiteColor];
imageWeightlabel.textColor = [UIColor whiteColor];
tagLabel.textColor = [UIColor whiteColor];
UIImage *imageBegin = [UIImage imageNamed:imageName];
UIImageView *imageView = [[UIImageView alloc] initWithImage:imageBegin];
UIView *cellSeparator = [[UIView alloc] initWithFrame:CGRectMake(0,545, self.view.frame.size.width ,3)];
cellSeparator.tag=1;
[cellSeparator setAutoresizingMask:UIViewAutoresizingFlexibleLeftMargin |
UIViewAutoresizingFlexibleRightMargin |
UIViewAutoresizingFlexibleWidth];
[cellSeparator setContentMode:UIViewContentModeTopLeft];
[cellSeparator setBackgroundColor:[UIColor whiteColor]];
[self.view addSubview:cellSeparator];
当你第二次打电话时删除超视图的子视图吗? – Balu
1.不是Xcode的问题,2.该类被称为'UIView',而不是'UIVIEW'。 – 2013-04-01 11:07:15
要将哪个视图添加该标签和imageView –