如何防止iMessage应用程序扩展中的导航栏下的视图 [英] How prevent view under navbar in iMessage app extension

查看:92
本文介绍了如何防止iMessage应用程序扩展中的导航栏下的视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在

I have the same issue in this post, i follow all recommended in that answers but notting works, in my case the difference is that i have a table view controller.

我已经尝试了多种方法来防止这种情况的发生.

I have tried in many ways to prevent this from happening.

示例:

-(void)viewDidLayoutSubviews {

    //the next 2 lines was tested with self.tableView and self.view
    [self.view.topAnchor constraintEqualToAnchor:self.topLayoutGuide.bottomAnchor constant:8.0].active = YES;
    [self.view constraintEqualToAnchor:[self.topLayoutGuide bottomAnchor]].active = YES;

    [self.tableView setContentInset:UIEdgeInsetsMake(self.topLayoutGuide.length, 0, 0, 0)];

    self.automaticallyAdjustsScrollViewInsets = YES;
}

内部viewDidLoad:

    self.navigationController.navigationBar.translucent = NO;

    if ([self respondsToSelector:@selector(edgesForExtendedLayout)])
        self.edgesForExtendedLayout = UIRectEdgeNone;

这是我的UITableViewController配置:

这正是我的问题:

感谢您的帮助.

推荐答案

您可以对视图使用约束.

You can use constraints to the view.

为紧凑型视图设置top View约束,例如:

Set a top View constraint for the compact view like:

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *searchViewTopConstraints;

在presentRecentsViewControllerFor中更新对紧凑和扩展视图的约束:

Update your constraint on compact and expanded view in presentRecentsViewControllerFor:

-(void)presentRecentsViewControllerFor:(MSConversation*)conversation withPresentStyle:(MSMessagesAppPresentationStyle)presentationStyle
{
  tableViewC = [[UIStoryboard storyboardWithName:@"MainInterface" bundle:nil] instantiateViewControllerWithIdentifier:@"ShareRecents"];
  if (presentationStyle == MSMessagesAppPresentationStyleCompact) {
     NSLog(@"Compact view");
     tableViewC.searchViewTopConstraints.constant = 0;         
  } else
  {
    NSLog(@"Expanded view");
    [self.view.topAnchor constraintEqualToAnchor:[self.topLayoutGuide bottomAnchor]].active = YES;
  }
}

这篇关于如何防止iMessage应用程序扩展中的导航栏下的视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆