将UIView添加到已添加到MainView的子视图中

时间:2013-05-01 12:23:40

标签: ios xcode uiview addsubview subviews

结构是这样的,..

  

*)MainView

     1) viewLocations(UIVIEW) // this one is adding fine

            a) viewBangalore
            b) viewHyderbad

其实我正在做一个iPad应用程序,在其中一个UIViewController中,我使用UiTableController作为滑动视图来选择Locations。根据位置选择,需要显示UiView的。

enter image description here

viewLocations - > CGRectMake(0108588533)

我的代码是:

 if (_detailItem) {
        Location=[_detailItem description];

        if ([Location isEqual:@"Bangalore"]) {
           self.viewLocBangalore= [[UIView alloc] initWithFrame:CGRectMake(10, 10, 500, 400)];
           // self.viewLocBangalore.frame = CGRectMake(10, 10, 500, 400);
            [self.viewLocations addSubview:self.viewLocBangalore];

          [UIView transitionFromView:self.viewLocHyderbad
                                toView:self.viewLocBangalore
                              duration:0.9
                               options:UIViewAnimationOptionTransitionFlipFromBottom

                            completion:^(BOOL finished) {
                                NSLog(@"Locations View Appeared %@", Location);
                            }];

        }

        else if ([Location isEqual:@"Hyderbad"])
        {
            self.viewLocHyderbad.frame = CGRectMake(10, 10, 600, 519);
            [self.viewLocHyderbad removeFromSuperview];
            [self.ViewLocations addSubview:self.viewLocHyderbad];

            [UIView transitionFromView:self.viewLocBangalore
                                toView:self.viewLocHyderbad
                              duration:0.9
                               options:UIViewAnimationOptionTransitionFlipFromBottom

                            completion:^(BOOL finished) {
                                NSLog(@"Locations View Appeared %@", Location); // getting this Log also, but View is missing
                            }];

        }




    }

到目前为止我已经尝试过了,我没有得到它的解决方案。到底发生了什么......? 感谢。

1 个答案:

答案 0 :(得分:1)

可能是某些其他视图重叠的视图,但我不确定尝试使用此方法。

[self.ViewLocations bringSubviewToFront:viewname];
相关问题