Create a timeline using UIScrollview with Swift 2.0 - uiscrollview

Excuse me for this probably complex question.
I'm currently working on a feature for an app that needs to present a timeline of a location. I have had influences from the app "Path" which also uses a similar method although they have implemented it for social media (forgive me if there is other related examples). I also looked at this example which I believe is the closest to my target but he creates the UI programatically which I haven't learn't how to do yet and am more used to using the storyboards. Therefore it may seem quite daunting to try an implement a similar method.
This is the layout I'm looking for where the 'Year' and 'Content' views relate to each other and the Content view adjust according to the amount of contents inside it i.e. text & images.
I really hope this isn't such a complicated ask but thank you in advance.

You would probably have to use a custom table view cell with a dynamic view controller. You can create a placeholder for the year/info labels and fill the content through a dynamic table view's class.
Here's an example: http://www.techotopia.com/index.php/Using_Storyboards_and_Swift_to_Build_Dynamic_TableViews_with_Prototype_Table_View_Cells

Related

WebComponents-like objects (or nested controls) in Xcode

I created a custom NSView that displays some data exactly the way I want it to (a line chart of sorts). I now want to add a couple of sliders to have the ability to zoom the displayed data in and out. I would also like to add a couple of checkboxes so that the incoming data can be interpreted and graphed in different ways, and maybe some scrollbars to be able to see past data. I need to have at least 5 copies of this view (with all its controls) on screen at the same time, each showing a different data feed.
This way of thinking a user interface falls nicely into the WebComponents paradigm where you can design a component that encapsulates many different ones. As I understand it, there is no way of nesting controls like this into a master control in Xcode.
Of course I could layout all the views and all the controls separately inside a view controller and achieve exactly what I want but it would not be as maintainable as having ONE object that I can duplicate either in interface builder or in code.
My question is: what is the proper way to achieve this in Xcode (if any)? I don't need code examples but rather a conceptual answer and I'm only interested in answers related to Cocoa rather than CocoaTouch.
I just learned that you can have multiple view controllers as child controllers. This is exactly what I was looking for as it maximizes reusability and reduces maintenance.

Xcode MVC Issue - Need a multi Model - single View

I've recently started working with Xcode, having come from a C# background. I'm struggling to implement something for OSX that I'd find fairly trivial in C#.
Basically, I want to create a model that contains, say, two points. I then want to open a window which contains a Custom View that is linked to an object that is a subclass of NSView. I then want to draw a line between those two points using the dirtyRect function of my NSView based object.
I've followed examples for this & it works fine. However, I want to be able to open a number of windows, each of the same type of view so the data is displayed using the same technique, but having each one associated with a different model.
How can I let my NSView based object know what model data it should be drawing? I assume I'm missing something stupidly simple here...
Thanks,
Tom.

In MonoTouch, is it possible to mix standard Views and iPhoneOSGameViews?

Is it possible to have like a main menu based on a let's say a DialogViewController, and navigate to a OpenGL-ES based iPhoneOSGameView ?
Yes. You can even add multiple OpenGL ES views as subviews of a standard UIView.
Though you ask about iPhoneOSGameView specifically, I recommend considering GLKView available as of iOS 5. This provides some of the same features as the iPhoneOSGameView as well as some of the generated boilerplate around animation and CADisplayLink. It would also give you the option of creating the view in the Interface Builder, should you desire. Finally, it is provided by Apple to fill a similar role and, arguably, would be more aligned with future development.
I have done the reverse. In fact, MonoGame supports opening iPhoneOSGameView as the main view and displaying standard modal view controllers over top of it. This functionality is in the GamerServices section of XNA.
I think you should create a simple example, print a solid color in the game view and try presenting it over top of a standard controller.
I would think it would work fine.

Cocoa OSX custom widgets/controls

I want to know how can I create custom widgets/controls in Cocoa.
Not a full tutorial, but some guidance on what to start looking into. I'm confused by custom views, Core Animation, etc. I feel lost.
I see a lot of cool looking controls, like in Reeder App, or Sparrow etc. For example:
The left side is a collapsable menu that includes animations etc. How can I achieve something similar? I thought of using a WebView + HTML + JavaScript, but that doesn't seem like a very optimized solution.
Controls are views, so if custom views confuse you, you'll need to get that figured out before moving on to custom controls. Although you should really read the entire View Programming Guide, the section called Creating a Custom View will get you started on creating your own views. Try creating a simple view that draws a circle, for example, or the time.
When you've got views figured out, move on to custom controls. Most controls work about the same way. The user touches them, and the control responds by: a) tracking the user's input, b) changing its value, c) sending its action message to its target, and d) giving the user some feedback by redrawing itself. To get started, first make sure that you know how to use controls. Reading Control and Cell Programming Topics should help, and the section titled Subclassing NSControl covers (obviously) creating your own subclasses.
The example you provided is pretty clearly Apple's Mail.app. The view on the left side of the window might be an instance of NSOutlineView, or it might be a custom class. Either way, NSOutlineView would be a good starting point if you want to duplicate that functionality. NSOutlineView is a subclass of NSTableView, which in turn is a subclass of NSControl, which in turn is a subclass of NSView. Read Outline View Programming Topics for help getting started -- tables and outlines are extremely useful, but also more complicated to use than basic controls like buttons and text fields.
I know it's only a part of the UI, but I've recently coded something similar to the sidebar. If you look though the source-code it may give you some help on learning how to use custom controls and cells.
You can check it out on Github:
https://github.com/iluuu1994/ITSidebar

How do you create a Keynote-like interface in Cocoa and IB?

the app I want to create will have an interface very like Keynote, with a list of pages on the left and one page in full on the right. These kinds of interfaces are very common yet I don't know how to do them in Interface Builder.
Are there any ready-made components? Apple doesn't offer any, afaik. Or does every developer recreate this from scratch?
I only need a general idea or tutorial, no finished code.
Thanks in advance!!
If you're referring to a scrollable list of same-size thumbnails, use NSCollectionView / NSCollectionViewItem. Should be very easy: the item would just display a thumbnail image based on your document editor view's current state. In 10.6, it got some drag and drop support, if I remember correctly from WWDC '09, so you can drag-reorder your pages this way, too.
For the editor side, the collection view would only work if all your pages are the same size, as it doesn't allow for variable-sized items. If all your "pages" are the same size, though, the collection view should actually work for this too.

Resources