首页 新闻 会员 周边

iOS屏幕旋转后子控件的变化问题

0
悬赏园豆:40 [已关闭问题] 关闭于 2014-11-03 12:46

这是关于旋转的一段代码

- (void)viewDidLoad

{

    [superviewDidLoad];

    [self   loadButton:self.view.bounds];

}

#pragma mark -  Rotate

 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation

{

    // Return YES for supported orientations

       returnYES;

}

 

- (BOOL)shouldAutorotate

{

    if ([[UIDevicecurrentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone){

        return NO;

    }else{

        return YES;

    }

}

 

- (NSUInteger)supportedInterfaceOrientations

{

        returnUIInterfaceOrientationMaskAllButUpsideDown;

 }

 

//屏幕旋转后调用

-(void)viewWillLayoutSubviews{

    NSArray*viewArr = self.view.subviews;

    for (UIView*view in viewArr) {

        [view removeFromSuperview];

    }

    [self   loadButton:self.view.bounds];

}

-(void)viewRoate:(CGRect)bounds{

    

//    CGRect frame = [self setControllerFrame];

    UIButton*button = [[UIButton alloc]initWithFrame:bounds];

    [button setTitle:@"button"forState:UIControlStateNormal];

    [button setBackgroundColor:[UIColorgreenColor]];

    [button addTarget:nilaction:@selector(openTablecontroller) forControlEvents:UIControlEventTouchDown];

        [self.view addSubview:button];    

}

 旋转后,子控件转动的效果感觉有点闪跳   请问该怎么解决呀???

问题补充:

应该很详细了  请大神们指点指点  我这个菜鸟!!!

一切都很淡然的主页 一切都很淡然 | 初学一级 | 园豆:151
提问于:2014-10-10 14:45
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册