【问题标题】:How to set an activity indicator on Custom button in iphone如何在 iphone 的自定义按钮上设置活动指示器
【发布时间】:2011-01-28 23:27:26
【问题描述】:

我是 iPhone 开发的新手。我想设置一个加载在我的自定义按钮上的活动指示器。请指导我。 (例如:应用商店 --> 搜索 --> 再显示 25 个(点击时)。

【问题讨论】:

    标签: ios iphone button activity-indicator


    【解决方案1】:

    UIActivityIndicatorView 添加为按钮的子视图:

    // Create spinner
    UIActivityIndicatorView *myIndicator = [[UIActivityIndicatorView alloc] 
      initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
    
    // Position the spinner
    [myIndicator setCenter:CGPointMake(myButton.frame.size.width / 2, myButton.frame.size.height / 2)];
    
    // Add to button
    [myButton addSubview:myIndicator];
    
    // Start the animation
    [myIndicator startAnimating];
    

    【讨论】:

    • 谢谢。是的,它有效,我如何更改指示器的位置。现在它正在加载按钮的左上角。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-10-12
    • 1970-01-01
    相关资源
    最近更新 更多