Collection View Not Visible in Simulator - xcode

I am extremely new at Xcode. I am building an app that has a collection view in it. It looks great in the storyboard view, but nothing shows up when I run the simulator. I have images and labels in the cells. I have created a subclass for the cells and made my connections for the images and labels into the .h file. For right now I am just making a stub prototype (cells don't link to anything). If anyone can give me an answer or just suggest something to try than that would be great.

You're making a dynamic prototype - to actually show data, you need to read up on datasources and delegates.
If I were you, I would start with trying to make a simple UITableView app first. Google UITableView tutorial to get started.
After you're familiar with the above concepts, then would I suggest to go through a collection view tutorial - it's a relatively simple set of concepts when you get it, but you have to get it first :)

Related

coding without storyboards

I am following a tutorial video on how to allow users to edit their profile. In this tutorial, they are using storyboards and I am not. I was wondering, do I have to use storyboards in order to follow along? Or can I use their code to plug into mine without the storyboard?
According to Apple documentation:
A storyboard is a visual representation of the user interface of an
iOS application, showing screens of content and the connections
between those screens. A storyboard is composed of a sequence of
scenes, each of which represents a view controller and its views;
scenes are connected by segue objects, which represent a transition
between two view controllers.
As you are probably guessing, storyboards contain information about widgets, animations, views that are required by the code you will be adding to yours. Additionally, Storyboards also contain the connection between the visual elements and the code (outlets and actions). All of that can be created programmatically but the code you will be pasting from this tutorial, if it's coming from a project that includes storyboards, won't contain this associated logic.
So, at this point, it would seem highly unwise to add complexity to your tutorial to recreate these elements at once. What I would suggest is for you to follow the tutorial and then try to remove some of these elements and replace them by code to obtain similar results just as an exercise to learn. Keep in mind that Storyboards have been around to simplify the design of UI in the application, so I would recommend for you to master their usage instead of shying away from them.

CoreData ArrayControllers in Cocoa Storyboards

I am developing the Mac OS port of an iOS App and do face a problem with NSManagedObjectContexts when using NSArrayControllers in the Storyboard based Cocoa app.
It's kind of a follow-up question to:
Storyboard with TabViewController in OS X Application - Core Data Array Controllers in each scene?
I do have some ViewControllers presented like in a TabBarController, showing the same CoreData Entities. They are loaded through NSArrayControllers, that are hooked up with InterfaceBuilder.
From my existing knowledge, it was no problem to get the data on the screens. Even editing and saving to CoreData works.
But I realized, that every Storyboard scene got it's own instance of the NSArrayControllers and each its own NSManagedObjectContext.
When changing and saving the data on one screen, it is NOT updated on the other screens, that are all bound through the IB bindings and work in all other cases. They are just showing the data, they have loaded initially and are not updating automatically.
I think the problem is, that the changed data from contextA is not merged (or synced) to the other contexts of the other screens.
What is the best way of doing that? Should I use the NSManagedObjectContextDidSaveNotification for this?
That would mean, I would have to write much code, to manually start merging the changes from one context to all the other NSManagedContexts. Does smell really bad to me. I think there must be a much easier way, that I am not aware of and unable to find out about.
If you do have a hint for me, please just stick me in the right direction.
Thanks for that already.
Problem solved, I did a thumb error with Cocoa Bindings: I just dragged an object in the storyboard to every scene and set that to the AppDelegate. I just instantiated several AppDelegates with this, very bad idea! I corrected this, referencing the AppDelegate through properties on my ViewControllers and now it works as it should be. IB just has its little edges, where one has to be totally aware, about what is happening.

Xcode 6 - Swift - Multiple views on a single-window storyboard cocoa app

Just last week I decided to dive into the world of Swift and Xcode development, and as of yesterday I am actively working on a new application. I have a lot of experience with Java Swing, but working with that is obviously a lot different than working with Apple's fancy interface builders and storyboards.
I am trying to develop a single-window application that has many different views that can be navigated by buttons. I tried to wrap my head around the way the storyboard works, but even after all my reading of the documentation I don't know really what I'm doing - I'm so used to working in hard code. It came to the point where I wrote my app's entire network layer just to avoid working with the interface.
Basically I have a set of different NSViewControllers, each with references to a few of their components (buttons, labels, etc) and I want certain buttons to be able to change the current view controller (preferably with a segue animation) to a different one. How can I approach this? I would guess that this isn't hard to achieve, but I am lost. Any help would be appreciated!
Let me know if I need to submit any code - I do have the basic classes written but nothing relating to this.
Thanks,
-Aidan

Tabbed application troubles in xcode

I am working with my first tabbed application in xcode. I am just testing with some stuff since I'm relatively new to programming. I am just using the 2 views already put into the template. I am putting a slider into the first view and am going to attach it to a text box with numbers. But that isn't the problem! This is probably really stupid and simple, but when i run the application just to see the stuff on the simulator, it is just showing a black screen. NO CLUE WHY! But its killing me and would love some help!
You are not suppose to make connections in AppDelegate. You should use a ViewController for each class. I.E. FirstViewController, SecondViewController. AppDelegate is usually only used for calling save/restore messages.
You are getting the error because the storyboard view is assuming you are assigning it to the correct view. When you create the storyboard say you named it TestApp. Then, you should have a few classes. TestAppDelegate, TestAppDelegateFirstViewController, TestAppDelegateSecondViewController. Or something along those lines. FirstViewController should connect to the first view on the tab view. The Second should attach to the second.
AppDelegate is almost never used for UI. I would suggest you find a book on the matter. I'll suggest "iOS Programming. The Big Nerd Ranch Guide". It helped me a lot when I started.
Photo Exmaple:
I did end up starting a new project. Weird that the black screen showed up.. not really sure why that error was popping up.. I'm not really that knowledgable about the different errors and bugs that a program can have yet! Getting closer though!

Xcode 4.2: What is the most effective method switching views?

I was thinking of games in particular, where there may be alot of views that need to be switched in and out. Could someone supply some sample xcode 4.2 code? Many tutorials have old xcode versions which have different initial code.
Thanks
Most efficient method I would say is usin the story board feature. Set up a new view controller inside the main storyboard file and then control drag from which red button on one view to the next one. Very easy and no code required. Email me if you had any problems dai.evans94#live.co.uk

Resources