I'm trying to make a tab page based application in Xcode 4.3. First step is to add more view controllers than the 2 already there.
I drag a view controller form the library, then ctrl+drag from the tab controller, finally i create new UIViewController h and m file - named "CalenderViewControl" and select that name in the filesowner for my new added Viewcontroller.
Now everything seems fine in design - i have a new tab, referring to my new page.
but.....
When i run the simulation and select my new page tab, the page is all black, and nothing happens.
I have tryed to connect the file owners view to the view of the view controller - without any luck.
What I'm i missing....?
Ulrik
The reason is because you need to delete a method in your .m file of your new view controller.
Just add some comment to the method called (void)loadView and you will see your new view controller display.
I hope to have been useful, I was stuck on that for a day and I finally figured out how to do it.
Good Luck!!
Related
I have a single view application then I added a tab bar controller.
On one on of the two new view, I drag a collection view and a collection view cell.
In fact, I follow this Youtube tutorial : http://www.youtube.com/watch?v=Pvvn1L2aPyA
, and I don't succeed to click+drag the collection View in a header file (2'20).
When I open Assistant editor with my collection view selected, the automatic file diaplyed is UIViewController.h. I don't think it's the good file and I can't click+drag the Collection View.
I tried to create a new subclass of CollectionView or ViewController linked with this View but nothing works. (I created an Objective-C file "PageCollectionView" subclass of UICollectionView. I changed the custom class of my Collection to "PageCollectionView and nothing change).
Can anyone help me to create a file where I can click+drag my Collection View and then try to follow this Youtube tutorial ?
Thanks
Pierre
In fact, I had to create a new View controller (File->New->File->Objective-C Class-> Name as you want (ex:DanViewController) and subclass of UIViewController).
And then in storyboard, select the Identity inspector (in Utilities) and set the custom class to the name of your newly-created class (ex:DanViewController).
By choosing this file now in your assistant editor, I can click+drag every controller of my View.
Hope it will help
Pierre
I am pretty new to xcode and for the life of me I cannot figure this one out. I am adding a view controller to a storyboard and I am trying to add a picker to that controller, I have the code in a header and main file I created but how do I link those files to the viewcontroller in my storyboard?
Here is how:
Create a custom UIViewController subclass for your code, eg MyViewController.h and MyViewController.m
in the storyboard drag out a ViewController
(i think you have done both of these steps)
in the Identity Inspector (panel 3 of left-hand side Utilities panels), under 'Custom Class' you should see your class in the scrolling list. Select it.
Then you will want to make links between your picker in the storyboard and your code....
I started my app as a single view application. I have the view with various buttons and labels connected to code. I want to add a button that links to another view.
I found a tutorial that guided me to click on the project and add a UIView subclass. However there is no option for that ( I think because I started it as a single view application).
I'm pretty new to all this so if anyone can outline a simple way for me to do this that would be great! I am using Xcode version 4.3.2.
Thanks!
You need to add a new Objective C class. Please refer to this:
How to create new View Controllers in XCode 4.3
If you started the app as single view using xib file the to add a class just go to name of the project on the left pane and right click on it. Then choose add new file. The pop up will appear to allow you to choose what type of class you want to add. Depending to what the new view is you can choose uiview controller or uitableview controller and so on. Just make sure you check mark with xib for interface user. That should do it. Hope it helps.
Adrian
I created an empty iPad TabBar application using XCode 4, without storyboards. I placed that app in a workspace. I then added the Kal source (obtained from the iPad Juice build) to the workspace as a separate project. The initial build was clean.
I then went to the Kal example (NativeKal) and added EventKitDataSource.h and .m, and NativeCalAppDelegate.h and .m. (The image below shows what files are in the example project)
This is the code from the NativeCalAppDelegate.h file:
I tried setting the first TabBar UIView controller to "KalViewController" as I would normally do when using Storyboards, but it isn't listed in the drop down list of classes.
The question is: how do I get the NativeCal example view controller to replace FirstViewController in the in my TabBar application?
Comments added as Answer.
My recommendation is to switch to storyboards it is a lot easier to do UITabBarControllers in them. You can do this by just creating a new storyboard and copy and paste everything into it and then control drag from the UITabBarController to the UIViewControllers that you want to be linked to the tab bar controller and it does the rest for you, everything else is the same after that. In storyboards you can set the first view controller to be loaded so if you need it to be KalController then you can set it when you set up the UITabBarController. You can also set this in the code. I found that storyboards were a great new feature to xcode, UITabBarCotrollers are a lot easier to do in them then in .nib files I could never get them to work.
Hope this has helped.
I have been developing an iPhone application using the Detail View template. At some point I realized that I wanted my application to have a Tab Bar View controller as the root view controller. It seems that you do not want to push a tab bar view controller onto a navigation view controller. So I decided to start a new tab bar project and migrate my existing application code over. I thought this would be easiest.
So I have done that and the project builds without a problem. But I cannot seem to reassign the tab bar view controllers to ones which I already have. So I am replacing, "FirstViewController" with one of my custom ones. When I attempt to run the application it calls:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
And bombs with a SIGABRT error. I'm not sure why this is. I cannot see what the default view controller (firstviewcontroller) is implementing that my custom view controller is not.
Can anyone give me some ideas of what I should check?
Thanks!
update
It seems that my problem is related to the fact that my custom viewcontroller is of type UITableViewController. If I change this to be of type UIViewController it seems to work.
Update
I added a Navigation controller to the storyboard and created a relationship from it to a blank TableViewController. Then I assigned this TableViewController to my custom UITableViewController class. This seems to work. I'm not sure what plumbing was missing before.