我有一个自定义uiview,我正在尝试更新帧大小.点击后,我会在方法中这样做.调用该方法,帧值发生变化,但屏幕上没有任何反应!
if (!touched) { GameBox *Box = (GameBox *)[self.view viewWithTag:40]; [Box setFrame:CGRectMake(20,20,100,73)]; NSLog(@"%f",Box.frame.origin.x); markButton.enabled = NO; guessButton.enabled = NO; [self.view reloadInputViews]; NSLog(@"The action bar should now be hidden"); } else if (touched) { guessButton.enabled = YES; markButton.enabled = YES; [self.view reloadInputViews]; NSLog(@"The action bar should now be visible"); }
解决方法
我猜你已经在Interface Builder中将self.view挂钩到了UIView.
为了更改UIView框架,在Interface Builder中转到File Inspector,取消选中Use Autolayout,然后在代码中更改框架.
希望这可以帮助.