I'm trying to create a menu for a local multi-player game that dynamically updates when peers become available on the network.
The interface I want to implement is a UIScrollView, where each page displays information about a peer. Ideally, these pages are added and removed when a peer's availability changes.
I have looked through several tutorials using UIScrollView, but they all seem to pull page information from a plist or pre-loaded array.
What I want must be possible; weather app behaves in a similar manner, dynamically adding or deleting location pages. I'm not sure where to turn for further help, though. How do I dynamically update my scroll view's contents as outside events occur?
I decided to go with UICollectionView instead, it seems to provide a better method of implementation for what I'm trying to accomplish. Thanks!
Have a look at this Ray Wenderlich Tutorial.
I've used it as a basis for doing a paged scroll and the mechanism is simple enough to extend to whatever dynamic scheme you would like.
You can check this site for Multiple Tutorials & examples for UIScrollview. The link:
is Here..
I am sure, you'll able to find some good code for your need. Hope it works for you.
Related
I need to create a iOS app where the main screen is very similar to the Facebook iOS App. I am using a UITableView to show the different posts in the feed. My question is:
What is the best option to implement this? One option is to insert Textviews/Imageviews/labels to the table view cell and another option is to have one UIWebView in each table view cell.
I have to show a lot of pictures and texts, so maybe html will be easier.
Any experience?
If you have to show a lot of pictures and text, adding one complexity level (like HTML) is not gonna help.
I'd suggest to start researching on how you can speed that huge table up, and how to retrieve the content you want to display on each cell. For instance, you could use a parallel thread that would retrieve the content in the background as you scroll down and would store it in a cache so it doesn't have to be done several times. RestKit or (depending on your specific needs) AFNetworking are surely of some help in your case.
Also, have a look to this article (a bit old, but still interesting!) on how improve your scrolling speed: Fast scrolling (and link to github example project)
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.
I'm working on a little program and would like to implement a menu in the style that is used in the Front Row application. I know this is an extremely open ended question but what would be the best way to go about creating such a thing?
I thought I could maybe use a NSTableView but from the looks of it, that seems overly complicated to get the scrolling to work correctly.
I'm wondering if I should just code my own menu view from scratch but wouldn't really know where to begin to start that.
Any thoughts or pointers would be great.
Thanks,
Apple provides sample code that shows how to implement a fullscreen, list-like menu:
https://developer.apple.com/library/mac/#samplecode/CoreAnimationKioskStyleMenu/Introduction/Intro.html
The code uses no AppKit classes (like NSTableView). The UI is made with Core Animation.
Another good core animation sample to create Front Row like Menus can be found in the following blog post:
http://bill.dudney.net/roller/objc/entry/20080111
I am using a NSSearchField to run a query over the internet and display the results in a table view. Whilst the query is running I would like to display a progress indicator inside an NSSearchField? I think I have seen this done in another application before.
Is there an open source component that I could use to accomplish this?
How would I go about doing this? What is the best way? What are the pitfalls?
The easiest way is to put the progress indicator above (atop) the search field and leave them as separate views. It used to be that view z-ordering would give unpredictable results and weren't encouraged. That's not been true for several OS X versions, now, so if it looks good and behaves as expected, I say go for it.
The harder way would be to subclass NSSearchField and muck around according to the goodies found in the Control and Cell Programming Topics for Cocoa guide.
I'd go for a custom subclass of UISearchFieldCell. Find the method that draws the background and try to add your custom drawing code there. I'd rather not fiddle with nested components. I think the one used in safari is also a custom control.
This is not my solution but I came across this question and I eventually found someone that worked out a solution and it worked for me:
https://github.com/owainhunt/UAShared/blob/master/UAShared/NSSearchField%2BSpinner.m
In Interface Builder.app (and some other cocoa apps), image dragging has a very nice/sexy effect of morphing the drag image while you drag a draggable item out of its window.
For example in Interface Buildler.app:
Show the Library Palette (⇧⌘L, or Tools Menu -> Library)
Drag an item out of the Library palette
NOTE: as you drag the item out of the Library Palette window, it morphs from an image of the original list item to an image of the icon of the dragged item.
I have fully implemented drag and drop in my Application using the normal Cocoa NSDragSource/NSDragDestination facilities.
However, I can't find a hook for doing this image morph while dragging. I'm returning the initial drag image by overriding
-[NSView dragImage:at:offset:event:pasteboard:source:slideBack:]
But this is only called at the beginning of the drag.
How do you signal that you would like to replace the current drag image (ideally using the sexy morph effect).
You guys beat me to it. :-)
Yes, JLNDragEffectManager is open source (with attribution in your apps, please) and available on my blog. It should work fine as-is with no modification back to 10.5, but I'm not sure back any further. Others linked to it (and it's easily googleable), so to avoid self-congratulatory blog linking, I'll leave it at that.
Issues: One developer commented on (and submitted code to fix) the lack of dragging offset support. I've just not gotten around to posting the update. That's the only outstanding issue I'm aware of.
Improvements: I'd like to add multiple "zones" (say, one per document, so dragging from doc to doc keeps table rows looking like table rows, but anywhere outside doc windows turns them into a file icon a la HFS Promise Drag). Some day ...
Design: The post itself details the reasoning behind the design and the relatively simple morphing effect (cross-fade plus size are animated using basic NSAnimation, etc.). The code (the class as well as the demo app) is thoroughly blocked out and commented.
Won't link to my own post but would love the karma of upvotes for my effort. ;-)
UPDATE: Similar (but better-integrated) functionality is available as of 10.7. If you are targeting 10.7 or higher, it's best to use the new API. JLNDragEffectManager works fine on 10.7, so it can be used for earlier-targeted versions.
JNLDragEffectManager does exactly that. :)
The API does not support this well. Joshua Nozzi gives a method that looks reasonable in this weblog post.
IB's effect isn't that fancy. It's a crossfade and scale. Hold down shift to see it more clearly.
As of 10.7+ the current approach is to use the
enumerateDraggingItemsWithOptions:
forView:
classes:
searchOptions:
usingBlock:
API on NSDraggingInfo. The documentation is really poor but the ADC samples like MultiPhotoFrame or TableViewPlayground can give a good idea on how to use the new mechanism.