解除ViewController转移父控制器的视图

时间:2015-02-15 19:52:45

标签: ios objective-c iphone uitableview uiimageview

启动时,我的应用程序如下所示:

enter image description here

在除了最上面一行之外的每一行上,我都可以推送一个新的视图控制器,并将其关闭,一切都保持不变。但是,如果我单击Instagram行,然后关闭推到它上面的视图,我的屏幕看起来像这样: enter image description here

在推送的Instagram控制器中,viewDidLoad看起来像这样:

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"Instagram";
    UIBarButtonItem *theButton = [[UIBarButtonItem alloc] initWithTitle:@"Post" style:UIBarButtonItemStylePlain target:self action:@selector(doit)];
    self.navigationItem.rightBarButtonItem = theButton;
    self.downloading = YES;
    self.mediaArray = [NSMutableArray arrayWithCapacity:0];
    [self.collectionView registerClass:[SBInstagramCell class] forCellWithReuseIdentifier:@"SBInstagramCell"];
    [self.collectionView setBackgroundColor:[UIColor whiteColor]];
    [self.collectionView registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionFooter withReuseIdentifier:@"footer"];

    [self.navigationController.navigationBar setTranslucent:NO];
    [self.view setBackgroundColor:[UIColor whiteColor]];

    self.multipleLastEntities = [NSArray array];

    self.instagramController = [SBInstagramController instagramControllerWithMainViewController:self];
    self.instagramController.isSearchByTag = self.isSearchByTag;
    self.instagramController.searchTag = self.searchTag;
    [self downloadNext];

    self.collectionView.alwaysBounceVertical = YES;
    refreshControl_ = [[SBInstagramRefreshControl alloc] initInScrollView:self.collectionView];
    [refreshControl_ addTarget:self action:@selector(refreshCollection:) forControlEvents:UIControlEventValueChanged];

    loaded_ = YES;

    [self showSwitch];

    [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryAmbient error:nil];

}

我这样看待这个观点:

SBInstagramController *instagram = [SBInstagramController instagram];


        instagram.showOnePicturePerRow = YES; //to change way to show the feed, one picture per row(default = NO)

        instagram.showSwitchModeView = YES; //show a segment controller with view option

        [instagram refreshCollection]; //refresh instagram feed

        [self.navigationController pushViewController:instagram.feed animated:YES];

对我来说,看起来UIImageView正在向下移动大约44个像素,这将是导航栏的空间,我只是无法理解为什么会这样做。我使用AutoLayout并将UITableViewUIImageView固定到顶部超级视图,但只有UIImageView才会移动。

0 个答案:

没有答案