Create an omnidirectional scrollview - objective-c

I want to create an omnidirectional scrollview that works pretty much like the one in the "Wall of Sound" app. As in, the user should be able to pull into any direction and never get to an end. I want to keep the move to be smooth (and not see the pages change as you would in a standard scrollview). Does anyone know how that can be done? Or would I need OpenGL for that?

Create a 3x3 grid of views, each the size of the viewport. As the scrollview moves into another section, rearrange the views to constantly put the viewport in the center. In most cases 3x3 is sufficient, but if redrawing the views is expensive, you may want to use a larger grid (5x5 for instance). This requires that you have some mechanism for splitting up your full view into tiles.
You can implement the same thing using CALayer if you like. If you go that way, you should consider instead using CATiledLayer. See Matt Long's quick introduction on CIMGF.

Related

Positioning items dynamically for different screensizes

Good morning!
I'm currently trying to create a view similar to this mockup.
I have put down 3 different screen sizes so you can see the issue.
I have a header background image (grey box) with an angled bottom. On the right I want to display an image, which obviously needs to be positioned.
Positioning it horizontally is no issue but how can I position the image vertically? I have it positioned fixed for one screen size but obviously need to make it flexible.
Any ideas? Help would be much appreciated!
David
You can definitely use measure as #rajesh pointed out, or you can use Dimensions. As far as getting the layout consistent across devices, using position absolute and measuring the device height should allow you to get consistency across these devices.
Check out this example I set up, it should be a good starting point at least.
https://rnplay.org/apps/pSzCKg

Change The Size of the SubWindow and the Area It Covers In Unity

I'm creating a simple 2D racing game in Unity. The game has another subwindow that displays the enemy's view. Kinda like a small screen on top; that lets you know where your enemy is or what he's doing.
Currently, I'm using a secondary camera to follow the enemy and a render texture to limit the display of the subwindow as well as its size.
However, I want the size of the window to be flexible like if i want the ratio of the window to be 4:3 instead of a perfect square. With my current implementation, whenever I rescale the subwindow, it just rescales everything up including the view being displayed. What I want to happen is, when I rescale the subwindow, the area being displayed should just be wider. It should just cover more area because I made the window wider. I want the view to be independent.
Is there a way to do this with my current implementation? If not, how can I achieve what I want?
I'm new to Unity so I really hope someone could teach me. Thank you so much.
The are viewed is independant of the size of your window, if you want to change how much is displayed instead of just re fitting the same content in another size you'll have to work with the field of view http://docs.unity3d.com/ScriptReference/Camera-fieldOfView.html

Recreate the BookCase in iBooks

I just wanted to know how you could implement a bookcase, like in iBooks, into your iPhone app.
I presume you would need to use a UIScrollView, but then I read somewhere that you need to use a UITableView. Which is it?!
You'd use code that others have already written, such as AQGridView.
I'm not sure if there's a better way, but you could create multiple small views or images (these would represent each book) then add these small views/images to the subview of a larger view in a linear format (leaving a space between each element). Then just set the background of your larger view as an image of a bookcase. Sorry I don't know of a better way.
And for the above solution I would use a UIScrollView.
You can implement it anyway you like, but it seems to me that a UITableView would be the easiest (which will scroll anyway). All of the magic will happen in your UITableViewDataSource, which is where you will decide what books are placed on what row.
Once you have decided which books to display you will have create a custom tableview cell that draws the appropriate objects.
To be honest, while not too difficult of a task, it will take a lot of effort to get looking right. If you are not comfortable with custom drawing then be prepared to spend time learning about the various image/graphic APIs.

Image Sequencer using CoreAnimation

I have a list of images (say 180 images of sequence) to animate. If I use UIImageView with its default image sequence, I get memory issue.
I wanted to use CoreAnimation API, but really don't know how to do it?
What is the best way to do this.
Regards
iWasRobot :P
There's a very hard to google example on how to perform view transitions with Animation, here it is:
http://developer.apple.com/library/ios/#samplecode/ViewTransitions/Introduction/Intro.html
Here you would need as little as 2 views. You would load images into the hidden view, then "transition" it in. Assuming your slideshow mode is long enough, you should have no issues with loading times.
Another thing that comes to mind is paging with UIScrollView. Here you would need as little as 3 views
http://ykyuen.wordpress.com/2010/05/22/iphone-uiscrollview-with-paging-example/
I hope this helps!

Keeping backing CAGradientLayer static when UITableView scrolls

I'm trying to use a CAGradientLayer as a background for a UITableView. Everything works well until the overlaying view is scrolled, at which point then the pre-rendered background scrolls up and out of the way along with the original screen of data.
This is code that is being migrated from an iOS 3.1.3 app using a UIImage as a background to something device/resolution independent-looks great, works well, but sniffing the device type and using an alternate png isn't the sort of code that I want to ship, much less maintain.
Any suggestions as to how to do this?
Found the solution to what I was trying to solve, courtesy of Matt Gallagher:
http://cocoawithlove.com/2009/08/adding-shadow-effects-to-uitableview.html
His blog post has quite a few nice touches, including shadowing relevant cells instead of the whole table (mentioned as a performance issue in Noah's response).
You may have to make the table view transparent, and add the gradient layer to the table's superview. Keep in mind that your scrolling performance is probably going to be hideous—Core Animation will have to composite every subview of the table for every frame it displays. You may be able to slightly mitigate this by setting the cells' layers to rasterize themselves, as described here, but expect things to be pretty choppy regardless.