I have a simple ViewController with 5 labels each of which get populated with data dynamically on runtime as a result of regex parsing. I want to show any simple "Wait" animation, while the labels are getting their data, to tell users that processing is taking place.
I read a lot of SO solutions which more or less try to do something similar but I am nt able to get the simplest of working code.
To start with I dont need how much % of work is done i.e. no progress bar. Just Wait is enough. Later on may be i would want to add that logic bt I need a start right now!
This should have worked but it doesnt :(
Have you tried adding UIActivityIndicatorView??
Very nice loading indicator project ... https://github.com/jdg/MBProgressHUD
If you need something simple than previous answer about the UIActivityIndicator is correct
Related
I have a TableViewController which is connected to a empty-"template" viewController. I would like to make each cell responsible for its own interface/design.
In other words: the viewController has all elements placed (like UIImage, UILabel, UIText, etc.) and each time when specific cell is selected the viewController starts to fill with specific images/resources. Moreover, it would be great if the resources will be taken from web or cloud (in order to not save everything in the application itself).
So, I imagine it somehow like this:
Flow sketch
The problem is that I deal with this for the first time, and tried to find different ways to solve this problem (in terms of implementation), therefore I would like to ask: does this idea can be implemented in this way or probably there is more reliable way, and which techniques or technology can be used for this realization?
Thank you!
You can do it in multiple approaches. It totally depends on the architecture you have been following.
You can use react/ key-value observing and set the keys when you get a response.
Alternatively, for a very small app or a POC, I would use alamofire as my network manager and as soon as I get a response, I would set the labels. I would use the image extension in alamofire to set the images as it takes more time to download.
I would want to know the exact problem you are facing to help you out. Generic discussion are not normally encouraged here.
Basically I'm trying to achieve the look apple has:
I want the user to be able to make a list and be able to scroll through them similarly to this. However, I want there to be a beginning/end to the list instead of a never ending loop.
This is exactly what I'm trying to do:
Any ideas on how to even get started with this?
Seems like a pickerview to me
http://codewithchris.com/uipickerview-example/
Goodmorning all,
In some cases I need to present a lot of alert dialog (overlapped on each other). At the moment i can't find another way to do this because i need to take trace of each user's answer for each question in my dialogs.
So, after 5-6 dialog overlapped i've something like this:
my interface is faded out till to black, there is a way to avoide it?
Thanks all in advance.
That happens because the alert has a slight transparent black background which appears on top of the view. The things is since you add a lot of them, at this point this translucent backgrounds they get combined and you get the non-transparent black one.
One alternative would be to not present the alerts all at once but in sequence. So when the first one is dismissed, you present the next one and so on.
Another alternative would be to write your own custom alerts. Then you could control the background as would be fit your application.
However, it does not seem you are using the alerts for what they are supposed to be used, which is errors or messages the user must know. Maybe there is another solution for you application, maybe using a form or something similar. They are quite an intrusive way to interact with an application, so they should be used accordingly.
Hope this helps and you get to figure out the best solution for your project. Good luck!
I'm making a third party keyboard for iOS and without autocorrect, everything runs smooth as butter, especially on older devices such as the iPhone 5 and 4s. Unfortunately, as soon as I re-enable autocorrect, the process starts to lag on the aforementioned devices. How can I prevent this?
How I set up my autocorrect
Every time the user presses a key, the word being typed is run through a function that a) tries to complete the word b) tries to correct the word. The words completed and stored are stored in an array and the first element of each array is set as the text of the label in the suggestion bar.
The process itself is pretty quick and the results are logged almost instantly, but typing fast is when the trouble starts.
My Thoughts
Which GCD method should I use to speed things up? dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INTERACTIVE) and dispatch_async(dispatch_get_global_queue(QOS_CLASS_UTILITY) seem like good candidates but I've never used GCD and would like others' opinions. Also, is there any other way of speeding up such a process? It doesn't seem like other third party keyboards are having this problem so I'm probably doing something wrong :(
Thanks in advance!
You are definitely on the right track. You should not be running the code that you want to make suggestions in the same thread that you have the user interaction as this will clog up the main thread.
So, I would call dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INTERACTIVE) to do all of your analyzation. Just remember, when you update the labels on your keyboard you have to go back to the main queue... For example.
dispatch_async(dispatch_get_global_queue(Int(QOS_CLASS_USER_INITIATED.value), 0)) {
//do all of your code that you need to get the values for the labels.
dispatch_async(dispatch_get_main_queue(),{
//update the labels with the value you got.
})
}
I am under one project.In that I am using some image files and some button.
When i use to place button in my viewcontroller and see that preview using
assistants editor. My button are mis placed in different places.so i thought to use autolayout.But small confuse in that. I am beginner to ios.I have some question?
METHOD 1
When I uncheck this autolayout option like image (A)shown below.its working perfect in all iphone simulator(3.5, 4, 4.5, 5.5). By setting autolayout using below option (B)
[A]
[B]
METHOD 2
At the same time when i put check mark autolayout option and use like this image show below.I am getting some misplace (Not in arrangement].I know I miss some constraints.But its not better than my above question
please give me some suggestion about this.Which one should I use?
METHOD 1 (OR) METHOD 2. I am new to ios .kindly suggest me something about this?
Method 2! Autolayout. It is very powerful and (if you get the hang of it) quite easy and intuitive to use. You can create pretty much arbitrarily complex user interfaces using it. It has its limits, but in most of the cases you don't encounter them and most of the times they are fixable using constraints set up via code instead of the interface builder if needed.
Method 1 was fine while it was the only option and may still be okay for simple layouts. But as soon as you want to have a little bit more complex relations between different UI elements, like one UILabel being half the size of a UIImage, you will run against a wall.
You may check here for differences between autolayout(Method 1) and autoresizing mask(Method 2). Apple suggests devs to have their view layouting using Autolayout so there is not actually a question in here.
You probably messed up with constraints as every beginner does so I would recommend you to take a time in here and try to finish this tutorial.