问题很简单,个人资料viewController
在状态栏下方有一个NavigationBar
我将另一个viewController
推到当前的viewController
之上。
这个新的viewController
会隐藏状态栏。
当我返回个人资料navigationBar
时,viewWillAppear
已经向上移动了状态栏高度的大小。
我尝试在我的public static ExecuteMultipleRequest MultipleRequest { get; set; }
private const int BatchSize = 250;
public static long LastBatchTime { get; set; }
private static void Batch(IOrganizationService service, OrganizationRequest request)
{
if (MultipleRequest.Requests.Count == BatchSize)
{
ExecuteBatch(service);
}
MultipleRequest.Requests.Add(request);
}
private static void ExecuteBatch(IOrganizationService service)
{
if (!MultipleRequest.Requests.Any())
{
return;
}
Log("Executing Batch size {0}. Last Batch was executed in {1}",MultipleRequest.Requests.Count, LastBatchTime);
var watch = new System.Diagnostics.Stopwatch();
watch.Start();
var response = (ExecuteMultipleResponse)service.Execute(MultipleRequest);
watch.Stop();
LastBatchTime = watch.ElapsedMilliseconds;
Log("Completed Executing Batch in " + watch.ElapsedMilliseconds);
WriteLogsToConsole();
var errors = new List<string>();
// Display the results returned in the responses.
foreach (var responseItem in response.Responses)
{
// A valid response.
if (responseItem.Fault != null)
{
errors.Add(string.Format(
"Error: Execute Multiple Response Fault. Error Code: {0} Message {1} Trace Text: {2} Error Keys: {3} Error Values: {4} ",
responseItem.Fault.ErrorCode,
responseItem.Fault.Message,
responseItem.Fault.TraceText,
responseItem.Fault.ErrorDetails.Keys,
responseItem.Fault.ErrorDetails.Values));
}
}
MultipleRequest.Requests.Clear();
if (errors.Any())
{
throw new Exception(string.Join(Environment.NewLine, errors));
}
}
中强制进行布局刷新,但它不起作用。
有什么想法吗?
答案 0 :(得分:1)
使用以下代码,
override func viewWillDisappear(animated: Bool) {
navigationController?.setNavigationBarHidden(navigationController?.navigationBarHidden == false, animated: false)
}
希望它有用
答案 1 :(得分:0)
在显示的viewcontroller中实现viewDidDisappear
并在进入profileview控制器之前再次显示状态栏。
override func viewWillDisappear(animated: Bool) {
UIApplication.sharedApplication().setStatusBarHidden(false, withAnimation: UIStatusBarAnimation.Fade)
}
答案 2 :(得分:0)
在应用中的plist文件隐藏状态栏中添加代码:
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>