I'm looking to implement a UIPickerView where the user presses spin and the picker selects a random option. I'm curious if there are any ways to make the spinning effect last longer?
The only way I've really thought of, or seen, is increasing the number of items in the component simulating that the picker is really "spinning". Is this my only option?
Thanks.
You may test the actual performance with the huge number UIPickerView first, or actually build a slot machine component like this one:
iPadSlotMachine
With the stock iOS controller, no, I do not believe this is really possible.
Your idea might work, but will probably suffer from some graphical glitches as you add/remove elements during animation. Definitely worth trying though, to see if it is good enough for your needs.
Unfortunately, I think you'd have to write your own custom controller to really get the "slot machine" effect you're after properly. I would suggest google around and checking github, etc to see if anyone has written an open source one.
Related
I always get stuck with managing rotation on iOS application, there must be some kind of efficient way to do it but apparently I haven't heard of it yet. My interface is too complex to be parametrized in InterfaceBuilder so I tried doing all these different things:
Build two interfaces, one for portrait and one for landscape, but I found it awfully tiresome to devise some methods that enable one view controller to keep up with the other, so when the device is rotated the second view controller knows where to pick up the story.
Change my views' frames manually inside willRotateToInterfaceOrientation:, but in this scenario my whole interface turns into a bloody mess quite randomly (while sometimes it does the job alright...)
What do you think best practices are? Where might have I gone wrong? What did I miss? Thx!
I always go for the second option and it has never let me down. If you do it right, you will have always the expected result. What I think it's happening to your application (and you call it bloody mess quite randomly) its because your UIView's will probably still have some autoresize definitions on the Interface Builder. Besides removing all the autoresizes I also uncheck the "Autoresize subviews" checkmark from the parent UIViews.
Just playing devils advocate to JackyBoy's comment, I think it depends on the complexity of your view. In lots of cases I have found it simpler to just use a landscape UI. The benefit for me is the ease of visualization. You know (more or less) what you are going to get without as much trial and error and it's easy enough to pass whatever data is needed along (i find that easier then dealing with moving UI components around programmatically). That said, I don't know if there is really a best practice. It's a do what feels best to you kind of thing, I think. Though if I had to guess Apple's definition of what the best practice would be then it might be to use the two views.
Oh, I should also add that you can leverage the 'springs' and such for components in a nib that can sometimes be enough to handle the rotation as well
Is pinch for font size changes in tableview ok re usability?
Seems a good idea from my perspective, but wondering would users find it ok, or does it break an iPhone best practice?
I read through the tableView human interface guidelines and didn't see anything explicit there. In the Direct Manipulation section it says:
people can use the pinch gestures to directly expand or contract an area of content
If the user is using a pinch and zoom to change all text in a tableview it doesn't really seem to me like it is really proper "direct manipulation." It seems like it is more of a global setting change with a generic gesture. I think the real decision would come down to why are you planning to offer this gesture to the user? Is there a common use case for your app that the user would want to adjust the font size often? Are they going to change it more than once per session?
I know it is nice to offer lots of features, but any extra features are just going to obfuscate the real features. It may confuse the user if they accidentally do a pinch and then the text size is changed and they don't make the connection.
Overral, I don't think it breaks and explicit rule, but I would be really careful about deciding to add this "feature." If there is a really good reason to do it, I would say go for it, otherwise, it probably isn't worth the risk of getting rejected from the store and/or possibly confusing the user.
I vote no if it's key to the functionality of your app. You're having to train people to do something that may not be intuitive for them to realize that's there. If you look that the Twitter official app, they do something similar to expand the content in that cell, but you could totally live without that capability if you didn't know it was there.
Recently I've been looking to create some way of showing a user that something is being loaded. I'm sure anyone with an iPhone has seen this is apps before but what is the best way of doing it?
I started using UIProgressHUD, however it was pointed out to me that you shouldn't really use private (undocumented) API's.
I then I moved onto this which is a custom version called MBProgressHUD, however in my experience with this is wouldn't show the loading part when trying to call it not from a button and I found it very buggy (It wasn't very hard to crash the example code given by just clicking away).
I then went on to find this by James Brannan from his book, however I'm not quite sure why he claims this is the "proper way" of doing it when I've seen many apps in the past with what looks like the UIProgressHUD.
Does anyone have any ideas?
EDIT: This is pretty good...
Thanks
There is no one "best" way. Another way to do this is to simply put a UIView atop your main view's subviews, mark its userInteraction property and grey it out when needed. You could even add a UIActivityIndicator as a subview of this "foreground" UIView, starting its animation when needed. When your loading has finished, hide/stop the activity indicator and clear the foreground view's color.
If you are talking about loading over a network, one good thing to start with is to enable the status bar network activity indicator:
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
Note that you have to set it to NO when you are done! That should only be used to indicate network activity.
That's a bit subtle though, it's a great idea to have some kind of progress indicator IF you can tell exactly how long something is going to take - downloads where you know the size and count incoming bytes, or uploads where you also monitor bytes outgoing and know the total size.
If your call length is very small or the size is not really known (web service call is a great example) then some kind of overlay with a UIActivityIndicator can be very relaxing (you can also make a custom variant with a set of images added to a UIImage view to animate). The key is, that if possible it should not block the user from doing other things if possible.
Also if you have multiple things going on, you might want to add messages describing what state you are in (like, "adjusting image", "uploading image", etc).
I've built a Navigation-based app, but now that I'm knee-deep in the code, I've decided it would actually be best to have just a UIToolbar instead (only need modal views, not drill-downs). But extricating the Navigation stuff and replacing it with a Toolbar is causing me all sorts of grief...
Has anyone ever done this, and maybe has a pointer or two? Or even know of a walkthrough linked somewhere?
Thanks!
Bite the bullet and rewrite. Any guides out there will not be specific enough to your situation.
99 times out of a hundred if I realise I've made a massive design mistake and don't change it, I end up regretting it more than if I do. And since you'll take a copy/start from scratch again, you can always revert if you need to give up half way through!
Seriously, because this is a current app that is still (relatively) early in its development life and is all fresh in your mind it will very likely be quick to re-do. Also, sounds like this might be one of your first iPhone apps so you're likely learning new stuff every day - now you get to put all the new stuff in this app too. And finally, just imagine the work involved if you put another 200 hours into this as it is and then decided you had to rewrite!!
Hope that helps, and I bet you get it rewritten in less than a day!
I am busy with a score overview and I was wondering what is the best way to do it.
My first thought is that is would be an UITableView because of all the functionality it already got.
But because of all the functionality it also has it limitation when you want to change the look.
I was wondering what is a better way:
An custom UITableViewCell what you design your way and that with an plain tableview
An UIScrollview where every score is an UIView
I think the first one is easier and probably better memory solution but the second one is better if you look at customization.
So I was wondering what you think and if you know some good reading about this.
The additional memory / cpu consumption is probably not noticeable, unless you've got more than 100 results or so.
Therefore I'd use a scroll view with UIViews, it's just so much simpler to implement. Additionally it's much easier to add custom behaviour later if you need something fancy.