我开发了一个谷歌地图,其中我正在显示atm附近的用户位置。我已经添加了一个活动指示器,用于在我的应用程序获取信息时设置动画,并且应该在获取信息时停止。
我已经编写了以下代码来执行此操作。我的活动指示器正在显示但不会被删除。请帮我这样做。
using System;
using System.Windows;
using System.Windows.Input;
namespace CommandsSample
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
#region NewFileCommand Handlers
/// <summary>
/// CanExecute
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void CouldCreateNewFile(object sender, CanExecuteRoutedEventArgs e)
{
e.CanExecute = !string.IsNullOrEmpty(FileText);
}
/// <summary>
/// Executed
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void CreatenewFile(object sender, ExecutedRoutedEventArgs e)
{
FileText = string.Empty;
}
#endregion NewFileCommand Handlers
#region Dependency Properties
/// <summary>
/// The contents of the TextBox in the UI are backed by this property
/// </summary>
public String FileText
{
get { return (String)GetValue(FileTextProperty); }
set { SetValue(FileTextProperty, value); }
}
// Using a DependencyProperty as the backing store for FileText. This enables animation, styling, binding, etc...
public static readonly DependencyProperty FileTextProperty =
DependencyProperty.Register("FileText", typeof(String), typeof(MainWindow), new PropertyMetadata(string.Empty));
#endregion Dependency Properties
}
}
提前致谢。
答案 0 :(得分:0)
在视图中更改didload在[self displayAtm];
中显示微调器之后最后调用此方法- (void)viewDidLoad
{
[self startUserTracking];
// [self displayAtm];
spinner = [[UIActivityIndicatorView alloc]initWithFrame:CGRectMake(135,140,50,50)];
spinner.color = [UIColor blueColor];
[spinner startAnimating];
[self.view addSubview:spinner];
[self displayAtm];
}