UIButton 内的 UIActivityIndicatorView [英] UIActivityIndicatorView inside UIButton
问题描述
我有几个以编程方式生成的 UIButton(自定义,200 x 200,白色背景),我想在其中放置一个 UIActivityIndicatorView.我用下面的代码试了一下:
UIActivityIndicatorView *playlistImageLoader = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];playlistImageLoader.center = CGPointMake(100, 100);playlistImageLoader.hidesWhenStopped = YES;[playlistImage addSubview:playlistImageLoader];[mainScrollView addSubview:playlistImage];[playlistImageLoader startAnimating];
但它没有出现?有什么想法吗?
谢谢!
你没有设置指示器框架,设置它作为按钮子视图就可以了.>
尝试使用 UIActivityIndicatorViewStyleGray
- UIActivityIndicatorViewStyleWhite
在白色背景上是不可见的.
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 内的 UIActivityIndicatorView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!