Im using story boards and in the Custom Class panel of the specific view controller if i give the name of the class that contains code for that view controller i get a blank screen. What could be the problem? Ive tried everything.
SO basically Class is usually UIViewController in CustomClass. I changed it to MenuScreenViewController(a ViewController objective C class that has code associated with this) and im calling it modally. Why do i get a blank screen. Urgent help please.
My guess, once again:
remove the implementation of - (void)loadView from your UIViewController subclass. You only need this method when you create your viewControllers view in code. When you create the view from a nib file or storyboard you must not have this method.
But it's not your fault, the implementation is there because of a bug in the Xcode 4.3 viewController templates.
EDIT: This bug is fixed in Xcode 4.3.2. The template does no longer contain - (void)loadView
Related
I'm a newbie in coding and I'm learning Swift to develop my first application.
I'm following this YT tutorial trying to integrate a SideMenu :
https://www.youtube.com/watch?v=iq-tWW45Vhk
The fact is that after I added the #IBAction func into my code like this:
I do not find the received action I create in the code like in the video at 4:47
I found out that this appears only in my first ViewController (the blue screen) of my StoryBoard but I want the function to appear on the top right view controller
Can someone help me?
Thx
Julien
For all viewControllers in story board you have to create separate swift class files, and create it's IBAction outlet in it's class file.
add viewController class here :
after this you will be able to create IBOutlet and IBActions in that class.
I found out that this appears only in my first ViewController (the blue screen) of my StoryBoard but I want the function to appear on the top right view controller Storyboard
You need to put the action in the view controller class where you want it to appear. If it's showing up somewhere else, it's in the wrong class.
I am have multiple view controller in my storyboard with same class called "viewcontroller.swift " and they crash but if I assign operate classes they don't crash how do i fix this?
Simple answer for that is you can not use single ViewController.swift for multiple view controllers in your storyboard. Just create a new class for every new view controller in storyboard.
I tried same ViewController sub class in Obj-C for multiple storyboard view controllers and mentioned storyboard id for each ViewController and it worked fine, no crashes occur. You can try this in Swift as well.
I am an Objective-C beginner and I am going through the tutorial to create an IOS app using Apple developer articles.
https://developer.apple.com/library/ios/referencelibrary/GettingStarted/RoadMapiOS/SecondTutorial.html#//apple_ref/doc/uid/TP40011343-CH8-SW1
I have created an unwind segue and I have gotten stuck. I have gone through SO posts such as given below
StoryBoard issue in Xcode 6.1
Change a UIViewController to a UITableViewController inside a storyboard?
Want to create a cool static UI but : "Static table views are only valid..."
I tried to modify the story board source to use "tableViewController" instead of "viewController", but the storyboard won't open.
I am sure that there is an easy solution, but I don't know enough Objective-C or IOS development to know what it is, or how to implement it.
I have my controller implementing UITableViewController and my view as UITableView. I have attached the screenshot below.
and the error message:
My source for ToDoListTableViewController.h is given below:
#import <UIKit/UIKit.h>
#interface ToDoListTableViewController : UITableViewController
- (IBAction)unwindToList:(UIStoryboardSegue *)segue;
#end
and the implementation
#import "ToDoListTableViewController.h"
#interface ToDoListTableViewController ()
#end
#implementation ToDoListTableViewController
. . . Other methods
- (IBAction)unwindToList:(UIStoryboardSegue *)segue {
}
#end
Your picture is kind of small so it's a bit hard to tell what we're looking at. Plus your descriptions are a bit vague.
The deal is that in order to set up a table view as a static table view, it must be managed by a UITableViewController, not a regular UIViewController.
A UITableViewController is a special subclass of UIViewController. When you go to add a new scene to your storyboard, you go to the list of UI objects, find the UITableViewController, and drag one onto the storyboard.
An annoying thing about UITableViewController objects is that the ONLY thing they manage is a table view. You can't use them to set up labels, buttons, and other UI elements. Just a table view and nothing else.
You said:
'I tried to modify the story board source to use "tableViewController" instead of "viewController"...'
I have no idea what that means. What is a "story board source"? You don't "Modify the storyboard source", you drag a UITableViewController onto your storyboard.
Then you said "...but the storyboard won't open." I also don't know what that means. You're going to have to explain that.
Luckily, there is an easy solution to this.
What you want to do is to create a regular UIViewController to manage everything but the table view, and then put a "Container View" in that view controller and set up an "embed segue" that installs a UITableViewController inside that container view.
Here's how you do that:
Search in the list of UI elements on the right side for "container". Drag a container view onto your view controller where you want your table view to appear. Then drag a UITableViewController onto a blank space on your storyboard to create a new storyboard scene. Then control-drag from the container view in your first view controller onto the UITableViewController. This creates an embed segue, which causes the UITableViewController to be loaded as a child view controller with its view inside and sized to fit in the container view.
Now you can have a window that has both a table view managed by a UITableViewController AND other contents.
There are more details to setting this up that are beyond the scope of a SO post. I suggest you do some googling on container views and embed segues and try to find a tutorial on setting them up.
I running the latest version of Xcode 5 and OSX 10.9.4. I am a newbie when it comes to Xcode.
I am trying to make buttons with a rectangular rounded border which apparently has been removed in iOS 7 from a simple UI object.
My work around is to create a UIController View Class and link my button to the class via an outlet with using the control drag method. But when I drag it over from the storyboard to the .h file of the class it does not automatically generate the outlet.
I have tried creating a new Objective-C Class that extends ViewControler and UIViewController, and have found that I cannot control drag the button to make an outlet for either class.
I was wondering if anyone else was experiencing this same issue or if they know what I am doing wrong.
Solution in Detail:
Create New Objective-C Class that is subclass of UIViewController (ViewController no longer supported)
Under Show the Identity inspector (seen below)
Add name of class created in step in Class box under Custom Class (seen below)
Note: It may show as a grey text of the class you want. You want to fill it out and make sure it is a solid black.
Check whether ViewController in nib have a proper reference to ViewController.h
Make sure that reference has been made properly with viewcontrollers in nib file.
I can't seem to be able to set the identity of my view to GraphViewController in Xcode 4.2.
I dragged a regular UIView in storyboard on a UIScrollView.
I create a new file called GraphViewController extending UIViewController (.h and .m) but when I click on my view in storyboard and try to set the custom class name (its identity) to GraphViewController, it doesn't set it. It doesn't even show it in the dropdown list.
Am I missing something here a connection or something?
You can set any class inherited from UIView to a UIView instance.
But you have created a UIViewController subclass, not a UIView subclass.
You can assign your custom class to the controller, not to the view.
In case anyone ever makes the dumb mistake I just did... ensure you have created an appropriate storyboard for either iOS or OS X. Adding the wrong one to your project will certainly cause issues like this.
My solution was making sure I was clicking on the controller's top tool bar, and not the "screen" UI frame. If you select the frame or anything in it, your Identity Inspector will be looking at the View, or other elements in the storyboard, instead of the controller itself.