У меня есть экран, на котором я добавляю различные компоненты, такие как кнопки, ярлыки и т. Д., Используя разные шаги Теперь после клика я хочу удалить все и отобразить другой вид.
Вот некоторый код:
-(void)estimateButtons:(NSString *)text andFrameX:(int)x andFrameY:(int)y andFrameW:(int)w andFrameH:(int)h
{
estimate = [UIButton buttonWithType:UIButtonTypeRoundedRect];
estimate.frame =CGRectMake(x,y,w,h);
//[estimate setTitle:text forState:UIControlStateNormal];
UIImage * buttonImage = [UIImage imageNamed:@"button_green_estimate.png"];
UIImage * strechableButtonImage = [buttonImage stretchableImageWithLeftCapWidth:12 topCapHeight:0];
[estimate setBackgroundImage:strechableButtonImage forState:UIControlStateNormal];
[estimate addTarget:self action:@selector(estimateSelected:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:estimate];
}
-(void)estimateSelected:(UIButton *)b
{
[self.view removeFromSuperview];
graph = [[SFNDoorBarGraphVC alloc]initWithNibName:@"SFNDoorBarGraphVC" bundle:nil];
[graph.view setCenter:CGPointMake(350, 660)];
[self.view addSubview:graph.view];
}
С помощью этого кода он удаляет все, но не отображает содержимое моего нового представления, которое представляет собой график.