如您所知,当我使用MPmoviePlayerController播放电影时,moviePlayer应该在moviePlayer视图的中心显示一个activityIndicatorView.现在,我已经在我的程序中放置了一个自定义activityIndicatorView,我只想隐藏或删除MPMoviePlayController的activityIndicatorView,我可以这样做吗?
我正在尝试向我的应用添加旋转活动指示器(UIActivityIndicatorView),同时解析来自互联网的数据.我有一个IBOutlet(微调器)连接到IB中的UIActivityIndicatorView.最初我设置如下:
-
(void) function {
self.spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle: UIActivityIndicatorViewStyleWhite];
self.spinner.hidesWhenStopped = YES;
[spinner startAnimating];
//parse data from internet
[spinner stopAnimating];}
Run Code Online (Sandbox Code Playgroud)
但旋转器不会旋转.我读到它与同一个线程上的所有内容有关.所以我尝试了这个:
- (void) newFunction {
self.spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle: UIActivityIndicatorViewStyleWhite];
self.spinner.hidesWhenStopped = YES;
[spinner startAnimating];
[NSThread detachNewThreadSelector: @selector(function) toTarget: self withObject: nil];
[spinner stopAnimating];}
Run Code Online (Sandbox Code Playgroud)
但仍然没有运气.有任何想法吗?谢谢.
好吧,我正在寻找一种方法来更改我的微调器图像并使用自定义图像
有什么建议吗?
iphone customization image objective-c uiactivityindicatorview
我想在Web视图中添加活动指示器.但我不知道web视图何时完成加载.我开始在viewdidload动画..
可能重复:
iOS SDK:通过代码UIImageView 将按钮移动到屏幕中心
.缩放和居中到任意矩形.无法在屏幕上确定正确的中心
我正在尝试将UIActivityIndicator集中在UIWebView中(它又是UIScrollView的子视图,左侧还有一个UIToolbar元素 - 尽管左侧工具栏并不总是可见)
之前已经提出过类似的问题,但重点是"动态地"找到中心,即改变方向以及左侧工具栏的存在与否.
什么是最好的方法?有没有比覆盖方法更好的方法shouldAutorotateToInterfaceOrientation呢?
iphone xcode screen-orientation uiactivityindicatorview ipad
我正在尝试创建一个networkActivityIndicator(在SWIFT中),但没有任何事情发生,我做了一些测试,但没有.此ActivityIndicator通常链接到WebView.
class ViewController: UIViewController, UISearchBarDelegate, UIWebViewDelegate {
@IBOutlet weak var WebView: UIWebView!
@IBOutlet weak var SearchBar: UISearchBar!
//WebView
func WebViewDidStartLoad(WebView : UIWebView) {
UIApplication.sharedApplication().networkActivityIndicatorVisible = true
println("Chargement")
}
func WebViewDidFinishLoad(WebView : UIWebView) {
UIApplication.sharedApplication().networkActivityIndicatorVisible = false
println("Fin chargement")
}
//SearchBar
func searchBarSearchButtonClicked(SearchBar: UISearchBar!) {
SearchBar.resignFirstResponder()
var text = SearchBar.text
text = text.stringByReplacingOccurrencesOfString(" ", withString: "+");
var url = NSURL(string: "https://www.google.fr/#q=".stringByAppendingString(text));
var req = NSURLRequest(URL:url!)
WebView.delegate = self
self.WebView!.loadRequest(req)
}
Run Code Online (Sandbox Code Playgroud) 我想弄清楚为什么我的活动指示器没有显示在我的视图控制器上,这是我的代码如下
var activityIN : UIActivityIndicatorView = UIActivityIndicatorView(frame: CGRectMake(0,0, 50, 50)) as UIActivityIndicatorView
activityIN.center = self.view.center
activityIN.hidesWhenStopped = true
activityIN.activityIndicatorViewStyle = UIActivityIndicatorViewStyle.Gray
activityIN.startAnimating()
Run Code Online (Sandbox Code Playgroud) 如何检查iPhone上是否启用了本地化?
我需要检查viewDidLoad方法中是否启用了地理定位.
这是我的viewDidLoad方法:
- (void)viewDidLoad {
[super viewDidLoad];
// 1. Check connection
[self performSelector:@selector(checkConnection)];
// 2. Loader (activity indicator) ...
progressViewController = [[ProgressViewController alloc] initWithNibName:@"ProgressViewController" bundle:nil];
[self.view addSubview:progressViewController.view];
// 3. Active geolocation
locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
[self startGps];
// 4. Data tableView
NSMutableArray *arrEvents = [[NSMutableArray alloc] init];
[[ListaEventiSingleton sharedListaEventi] setArrEvents:arrEvents];
[arrEvents release];
// 5. remove loader (activity indicator)
[progressViewController.view removeFromSuperview];
Run Code Online (Sandbox Code Playgroud)
}
//委托本地化 - (void)locationManager:(CLLocationManager*)manager didUpdateToLocation:(CLLocation*)newLocation fromLocation:(CLLocation*)oldLocation {
if (newLocation.horizontalAccuracy < 0) {
locality = @"Non …Run Code Online (Sandbox Code Playgroud) 我正在使用第三部分UIActivityIndicator SVProgressHUD,当我的视图加载时,我正在进行这项工作.我希望延迟activityIndicator大约1秒,同时我的应用程序中的一些事情发生.然后调用[SVProgressHUD dismiss]; 基于1秒等待......但我不知道该怎么做.
目前这是我的代码在viewdidload中的样子
[SVProgressHUD showWithMaskType:SVProgressHUDMaskTypeBlack];
[SVProgressHUD setStatus:@"loading..."];
[SVProgressHUD dismiss];
Run Code Online (Sandbox Code Playgroud)
我知道有一个dismisswithsucsess:计时器..但这似乎延迟了我不想要的成功消息出现的时间..我想延迟指标,没有文字..但只是想不到一种方法.
我试过了
sleep(1); //which dosnt work
Run Code Online (Sandbox Code Playgroud)
我也试过了
//[SVProgressHUD performSelector:@selector(stopAnimating) withObject:nil afterDelay:0];
Run Code Online (Sandbox Code Playgroud)
并把[SVProgressHUD解雇]; 在stopAnimating方法中,但是因为看起来所有的调用都需要在同一个方法中.
我已经在我的模型的扩展中声明了一个UIActivityIndicatorView作为计算属性.我有一个方法configureCell,我正在尝试使用活动指示器作为imageView的子视图.在这里,我能够将指标置于特定条件下,但以后无法对其进行任何更改.例如,我无法停止活动指示器,无法更改颜色,甚至无法隐藏它.
extension TranscationModel: UITableViewDataSource, UITableViewDelegate
{
var activityIN: UIActivityIndicatorView {
var act = UIActivityIndicatorView(activityIndicatorStyle: UIActivityIndicatorViewStyle.Gray)
act.color = UIColor.redColor()
act.hidden = false
act.startAnimating()
return act
}
func configureTransactionCell(cell : TransactionCell?, indexPath: NSIndexPath) {
if transaction.tid == "Something" {
activityIN.color = UIColor.greenColor() //Even this doesn't work
activityIN.center = cell.imgTransactionBill.center
cell.imgTransactionBill.addSubview(activityIN)
let delayTime = dispatch_time(DISPATCH_TIME_NOW, Int64(10 * Double(NSEC_PER_SEC)))
dispatch_after(delayTime, dispatch_get_main_queue()) {
activityIN.stopAnimating() //Not working
activityIN.hidden = true //Not working
}
}
}
Run Code Online (Sandbox Code Playgroud) iphone ×4
ios ×3
objective-c ×3
swift ×3
cocoa-touch ×1
geolocation ×1
image ×1
ipad ×1
uikit ×1
uitableview ×1
uiwebview ×1
webview ×1
xcode ×1