Pop up Alert or Message to user
I want to pop up alert from one view controller to any of the controller classes. I dont know where and in which view user will be.
开发者_运维知识库if in back end some process is going on, want to inform user to wait for some time.
Any help?
If you want to show a message to user an alert message you should use UIAlertView
or UIActionSheet
class (Link to the answer in what cases to use each one of them).
UIActivityIndicatorView
allows you to display a spinning wheel while some action runs in background, but note that to make it work main thread should not be blocked - your action must be performed in separate thread.
Edit: (I am not sure that this is the best solution). If you just want to show a message to user and do not need user interaction meanwhile you can do the following:
- Disable user interaction on your view
- Show some overlay view over your view (you can include
UIActivityIndicatorView
and UILabel with message to it). You can also make it with semitransparent background to get the similar behaviour to UIAlertView. - Dismiss the overlay view and reenable user interaction when you are over.
精彩评论