mic*_*ela 3 iphone xcode frame uiview cgrect
我有一个自定义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");
}
Run Code Online (Sandbox Code Playgroud)
小智 14
我猜你已经把自己的视频挂钩到UIView了Interface Builder
.
为了更改UIView框架,在Interface Builder
转到File Inspector
和取消选中Use Autolayout
,然后在代码中更改框架.
希望这可以帮助.
Mic*_*son 11
您需要在viewDidAppear(而不是viewDidLoad)中设置调整框架.
- (void) viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
CGRect frame = self.tableView.frame;
frame.origin.y += 100.0;
frame.size.height -= 100.0;
self.tableView.frame = frame;
}
Run Code Online (Sandbox Code Playgroud)
显然这与导航控制器中的表视图有关.
归档时间: |
|
查看次数: |
12571 次 |
最近记录: |