I'm new to iOS XCode6 ,trying to create a single view app . When I try to create an outlet connection to the label by drag and drop , nothing shows up as you see in the picture below. I did search the web all over to find an answer but nothing worked. I'm working from a text book which is made for beginners,following all instructions and nothing there mentioned about this issue. Any help will be appreciated.Thanks .
What you select is a LaunchScreen. You can not drag and drop from there into your viewController
Select the storyboard,set the class to the right viewController,then you can drag outlets
Set the class to the viewController here
Then you can drag outlets like this
Related
I am trying to create an outlet but xcode doesn't let me, I press ctrl+drag as always.
Here a screenshot of the viewcontroller and conversationVC.swift:
btw in the top right when I write the class as conversationVC.swift it always delete itself and stays empty,
please share your knowledge.
I have found the answer here, need to click on yellow button and then to set the class name
I use Xcode 7.2
I can use Control+drag to swift file to create a #IBOutlet
But I can't drag #IBOutlet in swift file to storyboard. Here I don't use any other key, just drag.
Actually when I moving mouse to the spot before #IBOutlet, nothing happened and when I trying to drag it a breakpoint added.
1.I`m sure I use the right Class name
2.My project is not in a strange path or name
don't use Control, only drag with mouse from circle icons.You can see in the picture below. Circle icons in red box
Changed Behavior
The behavior has changed in new versions of Xcode (I'm not certain but it might have been since 7+.). Older versions of the product might still have the gutter shortcut working.
Now you have to either open the Connections Inspector or right-click on the view controller in the Document Outline. Once open, drag from the defined IBOutlet to your UIView subclass (UIButton, UITextField, etc...)
Connections Inspector
Controller View
Official Guidance
Search your local help for: Interface Builder Connections Help: Creating an Outlet Connection. You will find these are the only methods that now work. The gutter shortcut does not work.
Nota Bene:
You can confirm this behavior and other changes to Xcode shortcuts by
choosing the following menu Help > Xcode Overview and
taking a look at Part V: Building a User Interface, section Connecting Objects In Code.
I started to learn IOS development. I am going through a video tutorial. The instructor is connecting the Hello World to the code by pressing control and using the mouse, as you can see in the screenshot :
I have windows 7 machine. I rented a mac VM from xcodeclub. When I tried to press control and connect the viewcontroller to the code by dragging mouse as done by the instructor, it do not connect. I am using windows keyboard. So how to do this ?
Is any other way to do this ? Or I have to use some other key + mouse drag ?
Fix. Try right clicking on the label and dragging from new referencing outlet.
Otherwise, check to see if your view controller is the correct class. Click on your storyboard file (probably called main.storyboard or something similar) and select the graphical representation of your view controller. Then, on the right hand side click on the small icon that is the 'identity inspector'. Make sure under custom class it displays UIView. If it doesn't, change it to UIView and try again.
If that doesn't work make sure you're dragging the blue line across the screen so that when you release it you are between the #interface and #end lines of code. Like this:
#interface
// drag it here...
#end
I made an simple UITableViewCell. I put there image view and an label.
I'm trying to drag them to the header file and then use them.
But once I'm clicking on the tuxedo icon I'm getting an NSObject.h instead of WorkoutCell.h .
Here is a picture:
(source: gyazo.com)
I'm trying to add the label and the image view. but I'm pretty new to ios/iphone/xcode so if there is any other way to do it without dragging it (with the ctrl key ofc) to the header file. please let me know .. ;)
and yes I tried to navigate to that header file, but it doesn't appear there ..
May be your cell's class in the identity inspector is NSObject . Change it to WorkoutCell.h . Now try
In your Interface Builder you need to set the custom class of the view.
1) Click on the view in interface builder.
2) On the right pan choose the 3rd tab from the left.
3) Choose the right Custom Class.
I've seen this happen lots of times before.
If you click the third icon from the left of the tuxedo, you can navigate your project files.
From here select the folder your WorkOutCell.h is in.
Maybe someone else can provide a more comprehensive answer as to why this happens, but with this navigation you will at least be able to access your WorkOutCell.h
I have just updated my Xcode to the latest version and the IB is quite different from the version I used before. I've created some IBOutlets and whereas before I could drag from the Files Owner to the component to marry up my IBOutlet from my .h file. In the new version there are three icons one of which is the Files Owner but it doesn't seem to do anything. How do I marry up my IBOutlets in the new version?
Press and hold 'Ctrl' key while dragging. You'll see a blue line. Drag the blue line to the item you want to connect and when you release you'll get a popover showing your outlets.
Alternatively, show the code file and the XIB file beside each other (using the assistant editor). Each outlet definition will have a circle beside it in the trough. Drag from there and you'll get the same blue line to connect with but this time Xcode knows the outlet so it just connects it as soon as you drop on the target view.