How to edit the interface connection in xcode 6? - ios

I just started to learn ios programming this week.... When I connection the button from storyboard to the swift code I forgot to change the connection to Action. So can anyone tell to how to edit it? Plus, if I don't want to use any of the connections how can I delete it? thanks!

Select your UI element in interface builder, open the Utilities panel and the Connections inspector should show all of your IBOutlets and IBActions.
Here you can remove a connection by pressing the "X" icon.

When you right click on your UIButton as follows,
you can see Send Events, under which there is Touch Up inside which shows the action clickMe it is connected to. You can delete it by pressing delete, x sign, next to it.
And then to bind the button with other action, select and drag from Touch Up Inside and release on your selected action method implementation on your view controller implementation.

To modify any Storyboard Connections:
Select your storyboard
Select the view you want to modify
Open the Utilities column (right most button in the top right corner of XCode).
In Utilities column, select Connections Inspector (right most button; looks like an arrow)
Click on the "X" for connections you want to remove.
If you want to trigger a callback when the button is selected:
Create a method in your view controller (i.e. -(IBAction)buttonCallback:(id)sender{...} )
Go to your Storyboard
Hold Ctrl and click on the UIButton, now drag the cursor to your view controller and release.
The method buttonCallback should show up, just click it.

Related

How to look up or edit existing IBAction?

When adding an IBAction by ctrl + drag it is possible to see this menu:
But how can I access it when IBAction is already created? How can I see or edit the values selected in this menu?
You can check IBAction already existed in xib or storyboard by click on view / view controller -> on the right menu, select Show the connections inspector
Then at the bottom, check Received Actions section:

Other buttons in my view are being pressed on button press

Something strange is happening in my app. I'm finding that when I press any button, all of the other buttons on my view are getting pressed. They all seem to be linked somehow.
There are no outlets connecting them to each other, they're not linked to the same function or anything. I can't figure out why this is happening? Any ideas why pressing one button will trigger a touchupinside event on another, unrelated button?
Thanks
I bet you created a button, added an action to it, and then duplicated it, dragged the copy to a new location, and added an action to the copy. Then you continued with that process.
Go to the "connections inspector" tab on the right (The circle with an arrow on it). Select each button. I'm guessing that you have multiple actions on each button. (A button can contain multiple actions.)

Xcode -- Alternate options for control+drag in story board to create a control segue for button

I am working on ToDoList app in IPAD.
I am getting problem to control+drag the button(Done, Cancel) to point to the "Exit" button in the bottom due to scroll issues.when i zoom-in in the story board for "Add To-Do Item" screen.I cannot see the below green button to connect due to scroll issues.
Will there be any other way i can point the "Done" or "Cancel" button clicks to unwindList segue.
Please provide me with any way to solve this issue.
Open the storyboard, click on the little icon in the lower left corner called "Show Document Outline" . You will see a list of elements with their names there. Control-Drag from the desired button name to Exit.
Also, right-click any view (including a button) will pop a small window with a full list (outlets and all). That window can be moved and dragged, so you can place it next to the green 'Exit' and drag from there. This comes handy when you need to control-click-drag from/to views that are far or tricky (without dropping it in the wrong place).
I think 'Touch up inside' is the click gesture.

Xcode: alternative way to create segue from control not using Control+drag?

I am running Xcode 4.3.3 over a VNC connection to a Max OSX box where Control+drag does not work. I would like to create a segue triggered from a button on the first scene. The usual way is to do control+drag from button to second scene but that does not work because of VNC. Is there an alternative way to do this? For creating outlets there is a workaround by right click on a control and dragging from the list of events to VC's sources code. Is there similar workaround for triggering segues?
Thanks.
if it's a UIButton, right click on it, you'll see a triggered segue option. Click on the round circle on the right side of it and drag it to the destination.
If it's a viewController, right click on the ViewController thing next to the First Responder (Orange box), you'll see also triggered segue option. Click on the round circle on the right side of it and drag it to the destination to create a segue.

Change class of TabBar in xCode4

I'm following the following tutorial that was made in xCode3
http://www.youtube.com/watch?v=LBnPfAtswgw
As I'm using xCode4, I followed everything until the part where she changed the class of the first tab to UINavigationController as I didn't got that option! Please help.
Regards,
Ali
You can do it without having to delete and drag new controllers in:
To change the type of an object:
From within Xcode 4, open your .xib file. If the interface builder object viewer isn't expanded, make it so by dragging it's right boarder out, or clicking that little 'play' button at the bottom.
Expand the Tab Bar Controller object to see it's children, and select the object you wish to change
Then choose it's Class type from the right panel, Identity Inspector. (To display the Identity Inspector, go menu: View > Utilities > Identity Inspector).
You can open and close that right panel using the buttons on the top right of Xcode. You can get to the various utilities by clicking the utility buttons, or through View > Utilities.
To rearrange tabs in the Tab Bar Controller, drag and drop them in the interface builder object viewer (this will change their position in the actual tab bar too).
I found alternative solution by deleting the default created tabs and drag new controllers which have the classes I need in my app.

Resources