1

我有一个自定义 uiview,我正在尝试更新帧大小。一旦点击它,我就会在一个方法中这样做。该方法被调用,并且帧值发生了变化,但是在屏幕上没有任何反应!我认为正在发生的是子类没有被重绘或更新

- (void)resizeWithTag:(int)tag wasTouched:(BOOL)touched
{
    if (!touched) {

        GameBox *box = (GameBox *)[self.view viewWithTag:40];
        CGRect frame = box.frame;
        frame.origin.x += 30;
        box.frame = frame;
        [[self.view viewWithTag:40] setFrame:CGRectMake(20, 20, 100, 73)];
        [box layoutSubviews];
        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");
    }
}
4

0 回答 0