Visual Studio不复制链接文件的目录(Visual Studio not Copying Directory of Linked Files)
暂存非托管库或资源时的常见做法是将这些资源添加为项目的链接,并将它们设置为复制到输出目录。
从Visual Studio 2013开始,这种处理方式非常好,即使它们被引用了库
Foo
,然后它将被应用程序Bar
,它们也会以Bar
的输出目录结束。尽管如此,文件目录似乎也是如此。
在这种情况下,我的应用程序似乎只在重建时才将此文件目录复制到输出目录。 然后不可避免地我会做一些构建操作,我会注意到
Libs
目录又是空的。 然后做一个重建和cef.pak
回来。我的解决方案是使用Build Step将
Libs
目录手动复制到输出目录。 尽管我找不到适当的宏来一般表达,即使这个构建步骤是Foo
一部分,我也希望将这些文件复制到条(例如VS中的StartUp Project )输出目录中。更新
感谢大家的好评和测试。 我应该澄清一点,如果两者之间存在额外级别的库,我仍然会看到这个问题。 也就是说应用程序
Bar
引用库Foo
引用库Other
是这些链接文件之一。 在这种情况下,当Other
人的链接文件被设置为复制到输出目录时,他们似乎只在重建时进行。 我对此的解决方案不太理想,即直接让Foo
参考Other
。A common practice when staging unmanaged libraries or resources is to add those resources as links to the project and set them to copy to the output directory.
As of Visual Studio 2013, this is handled quite well and even if they are referenced Library
Foo
which is then consumed by ApplicationBar
, they will end up inBar
's output directory.The same doesn't appear to be true for directories of files though.
In this case, my application appears to only copy this directory of files to the output directory on rebuild only. Then inevitably I'll do a couple build actions and I'll notice the
Libs
directory is empty again. Then do a Rebuild andcef.pak
is back.My solution to this was to employ a Build Step to copy the
Libs
directory manually to the output directory. Though I cannot find the proper macro to generically express that even though this build step is part ofFoo
, I want the files copied to theBar
's (e.g. StartUp Project in VS terms) output directory.Update
Thank you everyone for the great answers and testing this. I should clarify that I still see this issue when there is an extra level of library in between. That is to say Application
Bar
referencing libraryFoo
which references libraryOther
which is the one w/ these linked files. In that case, whenOther
's linked files are set to copy to output directory, they seem to only make it on rebuilds. My solution to this is less than ideal which is to haveFoo
referenceOther
directly.
原文:https://stackoverflow.com/questions/28700668
最满意答案
你需要在
navigationBar
添加menuView
let menuView = UIView() menuView.backgroundColor = .red menuView.translatesAutoresizingMaskIntoConstraints = false self.navigationController?.navigationBar.addSubview(menuView) [menuView.leadingAnchor.constraint(equalTo: (self.navigationController?.navigationBar.leadingAnchor)!), menuView.topAnchor.constraint(equalTo: (self.navigationController?.navigationBar.bottomAnchor)!), menuView.trailingAnchor.constraint(equalTo: (self.navigationController?.navigationBar.trailingAnchor)!), menuView.heightAnchor.constraint(equalToConstant: 60)].forEach{ $0.isActive = true }
结果
但是你必须保持UITableView / UICollectionView / UIScrollView&Scroll指标的contentInset
建议
在这种情况下使用TableView / CollectinView的Section Header。
You need to add
menuView
innavigationBar
let menuView = UIView() menuView.backgroundColor = .red menuView.translatesAutoresizingMaskIntoConstraints = false self.navigationController?.navigationBar.addSubview(menuView) [menuView.leadingAnchor.constraint(equalTo: (self.navigationController?.navigationBar.leadingAnchor)!), menuView.topAnchor.constraint(equalTo: (self.navigationController?.navigationBar.bottomAnchor)!), menuView.trailingAnchor.constraint(equalTo: (self.navigationController?.navigationBar.trailingAnchor)!), menuView.heightAnchor.constraint(equalToConstant: 60)].forEach{ $0.isActive = true }
Result
But you have to maintain contentInset of UITableView/UICollectionView/UIScrollView & Scroll indicator
Suggestions
Use Section Header of TableView/CollectinView in this type of situation.
相关问答
更多-
看起来我需要做的是检查设备是否运行的版本低于iOS 7,然后设置 [[[self navigationController] navigationBar] setTintColor:[UIColor blackColor]]; Looks like what I needed to do was check if the device was running a version less than iOS 7, then set [[[self navigationController] navigati ...
-
导航栏按下视图(Navigation Bar pushes down view)[2023-05-08]
您的约束可能设置为topLayoutGuide ,而不是视图的顶部。 顶部布局指南包含UINavigationBar和状态栏(如果存在),但将约束设置到视图顶部不会针对UINavigationBar (或状态栏)进行调整。 Your constraint is probably set to the topLayoutGuide, rather than the top of the view. The top layout guide includes the UINavigationBar and St ... -
我找到了解决方案。 我双击隐藏文本字段的导航栏区域,然后从中选择绘图>视图>隐藏。 隐藏的复选框未选中,所以我检查了一下,这使得用户名字段在导航栏中可见(奇怪!)然后我将其拖出那里并将其移动到导航栏下方。 我仍然想知道是否有更好的方法可以做到这一点,我确信有! 但这至少是某种解决方案。 (我仍然无法在我的场景轮廓中看到导航项) I found a solution. I double clicked inside the navigation bar area where the textfield is ...
-
保持挖掘视图的层次结构,如果UIScrollView位于视图的顶部,那么任何视图都将不会接收任何触摸事件。 添加了XIB的导航栏是主视图中子视图的一部分,因此您必须在导航栏下启动UIScrollView,y = 44 ScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 44, self.view.frame.size.width,self.view.frame.size.height-44)]; 并且不要忘记从ScrollView高 ...
-
iOS - 导航栏 - 带有另一个导航栏的内部表视图(iOS - Navigation bar - Inside table view with another navigation bar)[2023-05-05]
我在导航控制器内找到了解决方案导航控制器 I found the solution Navigation controller inside navigation controller -
你需要在navigationBar添加menuView let menuView = UIView() menuView.backgroundColor = .red menuView.translatesAutoresizingMaskIntoConstraints = false self.navigationController?.navigationBar.addSubview(menuView) [menuView.leadingAnchor.constraint(equalTo: (self ...
-
我刚刚启动了一个应用程序,并有同样的问题,您正在寻找的行是: self.navigationController.navigationBar.hidden = YES; 完整代码是: - (void)viewWillAppear:(BOOL)animated { self.navigationController.navigationBar.hidden = YES; } 确保你用下一个控制器重新开启它: self.navigationController.navigationBar.hidd ...
-
您是否确定选中了“属性”检查器中“显示导航栏”的复选框? 编辑 我看到你正在使用这一行: [viewControllers addObject:r] 你为什么做这个? 您的UINavigationController应配置为“初始视图控制器”。 您已经将segue设置为UITableViewController,因此应该可以正常工作。 编辑2 我认为这会导致问题: UIStoryboard *sb = [UIStoryboard storyboardWithName:@"RecentCalls" bund ...
-
在MasterDetailview Xcode 4.2中更改导航栏样式(change navigation-bar style in MasterDetailview Xcode 4.2)[2023-04-07]
//set navigation bar tint color [self.navigationController.navigationBar setTintColor:[UIColor blueColor]]; //or to set its style [self.navigationController.navigationBar setBarStyle:UIBarStyleDefault]; //set navigation bar tint color [self.navigationCon ... -
您不应该自己添加导航栏。 当场景嵌入导航控制器或导航堆栈的一部分时,界面构建器将自动执行此操作。 因此,如果您的tableview是根控制器,请选择您的场景,然后转到: 编辑器>嵌入>导航控制器 否则,当您将另一个控制器(即堆栈的一部分)的segue连接到tableview控制器时,将自动添加导航栏。 You should not add the navigation bar yourself. Interface builder will do that automatically when a scen ...