What approach should I take in developing simple animation based iOS game - ios

My question here is not about how to achieve something, but what all to include that would have the best effect for the content I am presenting.
I am designing an app (probably with single screen) which is story based. Not a story, but a scenario, to say. A typical scenario is driving through the street, going to office or both in one. And so on.
Upon each tap (or any user activity), next step of the scenario will reveal itself. Like meeting a person, colliding with a car and so on. But since these scenarios are virtually infinite, it is not possible to design graphics for my app. To say in other words, it won't be an office, an attic, a castle or a house. It can be any of that, or a combination of them.
Due to this limitation, and partially my laziness to deal with a lot of graphics (I don't have a subordinate, nor big bucks!), I have decided to do some simple animation upon each tap. A single object (like a ball) can roll or emerge from nowhere etc.
My questions:
1) Optional: How do I achieve this animation? I know objective c but I do not know if it suffice. Box2d is other option that I know of. Is it ok or an overkill? If objective c suffices, can anyone help me with simple code that will animate a rolling ball from far (center of the iphone)?
2) Required: Above is something I can figure out by myself, but this is more important: How do I devise my other UI to describe the scene and situation? What all iOS features would fit the best in situation? I can think of single UILabel to describe situation, but I do not know how I can position/animate it along with 1 above. Again, this seems far too simplistic however. Are there other iOS views that could help me?
Sorry for somewhat ambiguous requirement, but I am facing lack of imagination here, and I know if I am misled at this step, a lot of things can go wrong.
Thank you for your assistance.

Related

Working With UIViews... Too Much? iOS

Working on an app on which I have a few buttons at the top of the window, Hitting one of these buttons brings up a specific set of UI Elements (such as additional buttons or text fields). I was told during my Google travels searching for an answer, a best way to do this would be using more views, like showing a specific view when Button A was hit, or showing a specific view when Button B was hit. That works greatly, but it worries me. If I wanna have 20 buttons or so, would 20 different views be a problem performance wise? I just feel like thats a lot of views..
Is there a better way to go about this?
Thanks, Joe
In general the views will not be a performance problem.
Also in general don't optimize until you have a test that shows a performance problem. The key to writing good code it to write simple code that is easily understood. Later if there are performance problems investigate, find them and eliminate them. Xcode provides reasonably good tools for this in Instruments.
From Donald Knuth Premature optimization is the root of all evil (or at least most of it) in programming.
Views are the primary building block for UI in iOS. Having a lot of views is not likely to be a problem.
However, a UI with 20 buttons is likely to be cluttered and hard to use.

iOS Swipe Gesture Recogniser for a quick-paced game

I'm new to the iOS development world, so I'm starting off with a game that's neither Clash of Clans or the infamous 'I'm Rich'. I know Python and HTML/CSS so I will be able to cope with computer terms, but it would be great if you would be able to explain any answers.
A pattern flashes on the screen for half a second, let's say it is 'arrow left, arrow right, arrow left' (in picture form). Then the user has to replicate the pattern (in the right order) in order to boost forward. Basically, I'm asking what would be the simplest/most effective way of programming this? It would be great if I could easily add more patterns.
One way I thought that it could be done is to have an ID for each pattern, in which there are pre-defined 'nodes' that have to be swiped in a particular order. One benefit to this idea is that I can add patterns, however it could take a while to program them. Another idea I had is to assign an 'eraser' to the user's brush and it will detect when +-95% of the pattern is swiped. However, this would allow the user to swipe in any order.
Perhaps there is something super easy that I can do, but at the moment I have no idea. It would be great if I could do this in Apple Swift, however Objective-C is not a problem.
Thank you in advance,
Will
You basically answered your own question in the title. Take a look at the UISwipeGestureRecognizer documentation. From there you'd just want to push gestures into an array and then compare to existing pattern arrays

Disable iOS "Perspective Compensation" programmatically?

Maybe I'm just searching for the wrong term, but I've been able to find very little information on this subject, and I think it could be a problem for my app.
A while back, there was an article on the accuracy of the touch screens on iOS devices, and it seemed quite poor compared to other phones. Here is a link a posting about it:
http://forums.macrumors.com/showthread.php?t=1660713
Anyway, many of the commenters referred to "perspective compensation" as a cause for the inaccuracy. Basically, they are saying that iOS intentionally registers touches above the actual point of contact to compensate for the typical viewing angle of the user or for the angle of their finger or something like that. I have found that there is some credibility to that claim myself by doing as one of the commenters suggested and trying to use my iPhone upside down. I did find that it was difficult to touch things in some cases, and I have also noticed this problem in one of the apps I'm developing.
So, in case you want to skip all that rambling above, here is why it's a problem for me:
I am developing an app that is intended to be used by two people at the same time. The iPhone or iPad is placed on a surface between two people who are sitting across from one another, and they are instructed to quickly and accurately touch items on their respective halves of the screen competitively. What the article's comments made me suspect might happen, and what I have also found in practice is that the person using the phone upside down will have trouble touching buttons and dots on their first try. I've also tested slowly with a stylus and found that the touchable area of a button does indeed extend below a button, or above the button for the person using the phone upside down, hence the discrepancy and problem/disadvantage for that person.
So finally, if you want to skip that also, here is my question: Can "perspective compensation"(if that's what it's called) be disabled programmatically, and can it be done for specific views of an app? Have any of you noticed this and dealt with it in an app of yours?
While I have found that "perspective compensation" does seem to be occurring, I have not found any official documentation of it, and therefore have no idea how or if it can be disabled. When I search for "perspective compensation," the only results I find are links to the same article and comments.
I can't help but expect that this may have been asked before or is solvable with a simple checkbox, but perhaps for lack of the correct term to use, I have been unable to find any leads.
Thanks in advance for any of your solutions or suggestions!
This can't be done with the current SDK. All we have access to is the touch location, which is at a single point. Other search terms you might try are "digitizer" or "raw touch data", but there is definitely no check box or simple option.
To implement this, you will have to compensate for the touch location yourself. You'll need to play around with a compensating offset value for the upside-down buttons. Hit testing on views is probably the best place to do this, then your buttons can just respond to events as normal.

Build a "grouping" animation like Apple's iPad mail app

How can I do this "grouping" animation like Apple mail or the Gmail iPad app?
Does this need to be hard coded, and completely done with the animation framework, or does Apple expose an API for this to be done. I checked the developer docs, and I don't see anything like this. But Gmail was able to exactly replicate Apple's animation, and that's why I am curious to know if it can be done in an easier way.
I am 95% sure Apple does not have a UIStackOfPaperViewController or anything like that. You would have to code this up yourself.
Conceptually, it isn't too complicated: a background view with a texture, and each subview tilted at a random angle and a drop shadow beneath. You could do the drop shadow by drawing a gradient in a view around the "real" view. Core Animation's default behaviors would probably do the right thing, e.g. if you create the page view off screen and then set the final location, it will fly onto the stack pretty much how you would like it.
If you don't need support for releases earlier than iOS 6, there's probably good stuff in the Collection View Controller to make this easier.
Hopefully that's enough information to get you started, but your question is really broad. It's difficult to answer "How do I do X?" if you don't specify your starting point, or answer "How can I do this in an easier way?" if you don't specify what you think the hard way is first.

Timeline object type for GarageBand-type UI?

I'm working on a timeline app that needs to have a Garageband-type interface. I'm not a new developer, and I have a background in CGI and have been a Mac dev for over 20 years, but I'm a little stuck on what kind of objects to make that would represent the objects in the timeline. Are they UIViews? Drawn with QuartzCore? I Googled the heck out of the concept and looked at some books and came up empty. Any ideas on how to make these objects? I'd rather ask then start in one direction and realize there could be a better way down the road. Thanks.
Given that they allow user interaction, they're probably implemented as custom UIView subclasses. Since views are layer-backed, and since the timeline isn't flying all over the place and doing crazy complex animations, there's not really a good reason to have the UI be built directly from layers.

Resources