UIButton重新调整大小没有明显原因?

时间:2013-03-01 13:56:48

标签: iphone ios objective-c cocoa-touch uibutton

我有ViewController(1),它的层次结构是这样的

ViewController
- UIView
-- UITableView (height 80% of it's superview)
-- UIButton ( height 20% of it's superview, 80% offset y)

按下UIButton后,推送新的ViewController。直到现在一切正常,但在动画片刻,我看到UIButton被调整大小以适应整个视图。现在回去后,我在整个视图上都有我的按钮。

什么可能导致出现此问题?

1

UIPopOverController
- UINavigationController
-- UIViewController

编辑1:

- (void)viewDidAppear:(BOOL)animated
{
    // ... 
    _storeButton = [[UIButton alloc] initWithFrame:frame];
    _storeButton.adjustsImageWhenHighlighted = NO;
    _storeButton.backgroundColor = [UIColor colorWithHexString:(_productData.count > 0) ? @"0x8BC53F" : @"0xA4A4A4" ];
    [_storeButton addTarget:self action:@selector(storeButtonTouched:) forControlEvents:UIControlEventTouchUpInside];

    // ...
}

#pragma mark - Store request.
- (void)storeButtonTouched:(id)sender
{
    DLog(@"_storeButton: %@", _storeButton);

    if ( _productData != nil && _productData.count > 0) {
        _productData = [NSArray arrayWithArray:_iapManager.productData];

        TTIAPTableViewController *iapVC = [[TTIAPTableViewController alloc] initWithStyle:UITableViewStylePlain];
        iapVC.entries = _productData;
        iapVC.contentSizeForViewInPopover = self.view.frame.size;

        [self.navigationController pushViewController:iapVC animated:YES];
        [iapVC release];

    } else {
        DLog(@"No products available.");
    }

}

1 个答案:

答案 0 :(得分:0)