ios - how to Remove Dynamically Created UIView and UILabel text? -


i adding dynamic uiview named *cellseparator , other uilabels...now happen when again call code rewrite label text , overwrite on created label text...i not aware ios development.so can please tell me how can remove uiview dynamically before creating again?beacause uiview dynamically created dont know how remove uiview

  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];  

you write method remove subviews of view , modify code according need.

- (void)removesubviewsofview {     nsarray *subviews = [self.view subviews];     for(uiview *view in subviews)     {         [view removefromsuperview];     } } 

Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -