UIButton 内的 UIActivityIndi​​catorView [英] UIActivityIndicatorView inside UIButton

查看:30
本文介绍了UIButton 内的 UIActivityIndi​​catorView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个以编程方式生成的 UIButton(自定义,200 x 200,白色背景),我想在其中放置一个 UIActivityIndi​​catorView.我用下面的代码试了一下:

UIActivityIndi​​catorView *playlistImageLoader = [[UIActivityIndi​​catorView alloc] initWithActivityIndi​​catorStyle:UIActivityIndi​​catorViewStyleWhite];playlistImageLoader.center = CGPointMake(100, 100);playlistImageLoader.hidesWhenStopped = YES;[playlistImage addSubview:playlistImageLoader];[mainScrollView addSubview:playlistImage];[playlistImageLoader startAnimating];

但它没有出现?有什么想法吗?

谢谢!

解决方案

你没有设置指示器框架,设置它作为按钮子视图就可以了.>

尝试使用 UIActivityIndi​​catorViewStyleGray - UIActivityIndi​​catorViewStyleWhite 在白色背景上是不可见的.

I have a couple of programmatically generated UIButtons (custom, 200 by 200, white background) where i wanted to put a UIActivityIndicatorView inside. I tried it with the following code:

UIActivityIndicatorView *playlistImageLoader = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
playlistImageLoader.center = CGPointMake(100, 100);
playlistImageLoader.hidesWhenStopped = YES;

[playlistImage addSubview:playlistImageLoader];
[mainScrollView addSubview:playlistImage];

[playlistImageLoader startAnimating];

But it doesn't show up? Have any ideas?

thanks!

解决方案

You didn't set the indicator frame, set it and it will be alright to have it as a button subview.

Try to use UIActivityIndicatorViewStyleGray - UIActivityIndicatorViewStyleWhite is invisible on the white background.

这篇关于UIButton 内的 UIActivityIndi​​catorView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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