1

我是第一次使用 Objective-C,并且在给我的应用程序中有一个奇怪的错误。以下图片展示了我遇到的问题:

旋转画面正常显示

此屏幕在用户旋转 iPad 时显示。这个是正常的。顶部的控件 (<) 允许用户隐藏左侧的子视图。隐藏子视图后,深蓝色部分应扩大以填满屏幕。在我使用该应用程序之前,这很有效。现在,这正在发生:

隐藏拆分视图时的错误

我还没有找到任何东西来解释为什么会发生这种情况。有任何想法吗?

- (void)viewDidLoad {

    [super viewDidLoad];

    [self addGestureRecognizers];


    // initialize the "<" button...

    toggleButton = [[UIBarButtonItem alloc] initWithTitle:[PanoUtils leftIndicator] style:UIBarButtonItemStylePlain target:self action:@selector(toggleScreen)];
    // the annotate button...

    annotateButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"Pencil.png"] style:UIBarButtonItemStylePlain target:self action:@selector(annotateTapped)];
    // the done button for annotations...

    doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(doneAnnotateTapped)];
    // a flexible spacer...

    nameFieldSpacerButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
    // the accelerometer button...

    alignButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"gyro.png"] style:UIBarButtonItemStylePlain target:self action:@selector(align:)];
    // and the search button.

    searchButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"Search.png"] style:UIBarButtonItemStylePlain target:self action:@selector(searchButtonTouched:)];


    // customize the align button after the user selects it.

    UIImage *buttonImage = [UIImage imageNamed:@"gyroSelected.png"];

    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];

    [button setImage:buttonImage forState:UIControlStateNormal];

    button.frame = CGRectMake(0, 0, buttonImage.size.width, buttonImage.size.height);

    [button addTarget:self action:@selector(align:) forControlEvents:UIControlEventTouchUpInside];

    alignSelButton = [[UIBarButtonItem alloc] initWithCustomView:button];



    NSMutableArray *itemsArray = [toolBar.items mutableCopy];

    [itemsArray addObject:searchButton];

    [itemsArray addObject:annotateButton];

    [itemsArray addObject:alignButton];

    [toolBar setItems:itemsArray animated:NO];

    [itemsArray release];



    [self adjustToggleButton];



}
4

0 回答 0