Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 解除ViewController会移动父控制器的视图_Ios_Objective C_Iphone_Uitableview_Uiimageview - Fatal编程技术网

Ios 解除ViewController会移动父控制器的视图

Ios 解除ViewController会移动父控制器的视图,ios,objective-c,iphone,uitableview,uiimageview,Ios,Objective C,Iphone,Uitableview,Uiimageview,我的应用程序在启动时看起来像这样: 在每一行上,除了最上面的一行,我可以推一个新的视图控制器,然后将其关闭,所有内容都保持不变。但是,如果我单击Instagram行,然后关闭推到其上的视图,我的屏幕如下所示: 在按下的Instagram控制器中,viewDidLoad如下所示: - (void)viewDidLoad { [super viewDidLoad]; self.title = @"Instagram"; UIBarButtonItem *theButton

我的应用程序在启动时看起来像这样:

在每一行上,除了最上面的一行,我可以推一个新的视图控制器,然后将其关闭,所有内容都保持不变。但是,如果我单击Instagram行,然后关闭推到其上的视图,我的屏幕如下所示:

在按下的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];
我的观点是这样的:

- (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
,并将
UITableView
UIImageView
固定在顶部超级视图上,但只有UIImageView移动。

显示图像视图约束。它们存在一些问题。已找到问题。Instagram view控制器将navigationBar设置为Translucent为NO,以便连接段栏。在ViewWillEnglish上将其设置为yes可以解决问题。我的约束没有任何问题。