【问题标题】:Adding a UIView's to the Subview which is already added to the MainView将 UIView 添加到已添加到 MainView 的子视图中
【发布时间】:2013-05-01 12:23:40
【问题描述】:

结构是这样的,..

*) 主视图

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

            a) viewBangalore
            b) viewHyderbad

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

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

我的代码是:

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

        }




    }

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

【问题讨论】:

  • 检查视图背景颜色?
  • @Sunny 我也试过了..
  • 您确定 self.viewLocations 已连接(不是 nil)吗?
  • 一次检查所有的视图意味着那些或不等于nil。
  • @Sunny,Mariam N:这些东西没问题。检查每次编译..

标签: ios xcode uiview addsubview subviews


【解决方案1】:

可能是其他视图与该视图重叠,但我不确定是否尝试使用此方法。

[self.ViewLocations bringSubviewToFront:viewname];

【讨论】:

  • 感谢您的回答,但没有任何反应。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2011-06-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-07-31
相关资源
最近更新 更多