Adding a UIView's to the Subview which is already added to the MainView

杀马特。学长 韩版系。学妹 提交于 2019-12-11 05:30:16

问题


The structure is like this,..

*) MainView

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

            a) viewBangalore
            b) viewHyderbad

Actually I'm doing a iPad App , in one of the UIViewController I've used a UiTableController as a sliding view to pick the Locations . According to locations pick ,need to display UiView's.

viewLocations --> CGRectMake(0,108,588,533)

Here My code is :

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

        }




    }

I have tried so far , I din't get the solution for it . what is exactly happening here ..? Thanks.


回答1:


may be some other view overlaps that view but i'm not sure try with this method .

[self.ViewLocations bringSubviewToFront:viewname];


来源:https://stackoverflow.com/questions/16318003/adding-a-uiviews-to-the-subview-which-is-already-added-to-the-mainview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!