UIActivityView 和阻塞
我有一段上传图像的代码:
[activity startAnimating];
[self uploadImage:img Session_id:appDelegate.sessionID PlaceID:place.placeID Comment:comment.text];
[activity stopAnimating];
我确信该活动已正确连接到 UIActivityViewIndicator,但它从未显示。在 uploadImage 函数中,我打开与服务器的连接并开始上传。有人有关于为什么活动视图不显示的示例或可能的解释吗?
I have a section of code that uploads an image:
[activity startAnimating];
[self uploadImage:img Session_id:appDelegate.sessionID PlaceID:place.placeID Comment:comment.text];
[activity stopAnimating];
I am sure that activity is wired up correctly to a UIActivityViewIndicator, but it never shows. Inside the uploadImage function, I open a connection to the server and start the upload. Does anyone have an example or possible explanation as to why the activity view would not display?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您在主线程上进行上传,那么它会被阻止并且 UI 无法更新。
我建议在后台线程上运行它。
If you're doing the upload on the main thread, then it's blocked and the UI cannot be updated.
I would suggest running it on a background thread.