Cannot connect UIImageView with ViewController. Did they change that? - swift

This is my first time being on this forum. It's nice to be here and i really want to thank you all for the educational lessons you are giving!
So i am suffering from this issue :
i am using Xcode 7 and i did try with the latest Xcode of yosemite(6.4 version) and it seems i cannot establish an outlet connection via the old ctrl and drag method to connect a UIImageView with the ViewController. i did search the net a bit and i found some "solutions" of doing a reference to the header file but it didn't work. Did this method got removed and if yes how are we connecting now an element with the ViewController? is something wrong with my Xcode and if yes how can i fix it?
really appreciate your help!

First of all create outlet object
than go to storyboard or xib.
right click on file's owner (yellow box on top of xib).
you get all the outlet than click on circle right side of your outlet and map with UI by dragging the line.
hope this help you.
in this method you have to create outlet manually.

So yeah i did manage to fix the issue. It appears there is a bug with swift and Xcode and i can tell it happens in all Xcode version 6 and up including Xcode 7. I don't know what exactly occurs this bug and i can't really link an element from scoreboard with ViewController via the simple ctrl drag and drop method but in order to fix i had to reimplent the tableView and reconfigure my elements. this did the trick and i was able to just ctrl drag and drop. if someone knows what occurs this issue please comment!!
thanks

Related

WatchKit Extension[4608:145616] Unable to find image named "hello" on Watch

Problem:
Trying to set the WKInterfaceLabel text using xCode 6.2 but it returns this error:
WatchKit Extension[4608:145616] Unable to find image named "hello" on Watch
Code:
#IBOutlet var lblPassword: WKInterfaceLabel!
lblPassword.setText("hello")
Cleaning the project doesn't seem to fix the issue for me. But if you click on the image file, you'll see "Target Membership" options on the right pane. Select all of them, Clean the build and try again.
I got the same error although I am pretty sure these image files exist.
I just terminated Xcode, relaunched it, cleaned the project (command + K) and built it. It started to work again.
I do this routine whenever I face a new problem. It solves most of the problems as you might know. Sorry if you have done it already.
I supposed that you adding image to asset catalog in WatchKit Extension. This is wrong.You should add that image to asset catalog in WatchKit App. Sorry i can't add image here.
Try as I might, my images were not loaded up to the watch until I did it directly by 'caching' as follows in my InterfaceController in the WatchKit Extension:
[[WKInterfaceDevice currentDevice] addCachedImage:[UIImage imageNamed:#"carrota.png"] name:#"carrot"];
[self.portfiolioImage setImageNamed:#"carrot"];
For me, it looks like you have added "hello" as an image name somewhere in the storyboard.
Use XCode's Find dialog to look for "hello". It will show use as an image name, too.
Screen Shot 1
Ok So the keything to note here is that "you do not want to drag and drop the images into the AssetCatalog"......the only way this worked for me was to manually right click on the catalog (as shown in screen shot 1 and "Add Files"....look for the image you want to add on your local/external drive (Making Sure that only the "WatchKit App" Checkmark is selected in the Add to Targets Section" as shown in Screen Shot 2) and add the images!!
Screen Shot 2
i've had the exact same problem. solution: i've exedently connected the group parenting the WKInterfaceLabel. Try setting YOURSUPPOSEDLABLE.setTextColor(.brown), if the Background of it changes, you have connected the group.
So in my case I had copied and pasted a prior row and assigned a diff class.
That duplicated row's group still had an IBOutlet connection to the prior class that I did not catch.
Once I removed that connection this stupid issue resolved itself and I was able to successfully call .setText()

Type error Xcode 6 swift

I having issues with Xcode, I connect my element (button) to an IBOutlet but when I try to access button, it gives me the <>> message where it should be a completion suggestion. I have connected correctly my storyboard with my view controller. Here's a screenshot, so you can see. I hope you can help me. Thank you. Ok, I have not enough reputation so I will put an URL to the image.
http://i61.tinypic.com/28at08x.png
Just delete the app and download it again from AppStore.

Xcode 4.2 is missing a .xib file?

So I'm pretty new to programming, so I downloaded Xcode 4.2 and got to work. I watched many online tutorials and the main problem I was having was that all the tutorials were for Xcode 4 and not 4.2, meaning when you chose empty application setting, it was missing the .xib file. So I found a tutorial on how to create a .xib file. I got through it all except for one step, and that was to drag the from the window outlet of the xAppdelegate to the window. I've tried this over and over, but it doesn't work.
Here is the tutorial if anyone needs to see it http://www.trappers.tk/site/2011/06/16/mainwindow-xib/
Please someone help me!
You need to hold Ctrl while dragging, else it will not work.
Guide.
As you Control-drag from an object to your source code, Interface Builder indicates where a new binding is valid. After you’ve made the connection, Xcode displays a dialog you use to configure the binding. You can use the dialog to configure all aspects of the binding.
Interface Builder uses the Xcode index to determine which key paths are valid, and can also discover what controller it should connect through—you can therefore connect from a user interface element such as a table column to a property in a model class header.
Check out the video here.
You should choose a SingleViewBased Application instead of Empty Application then study all files that how they connect with each other. You can choose Master Application also. They will help you.
see this Hello world Tutorial click me.
And Youtube is the best way to learning for beginners. Search tutorial video because action teach more than the text.

How to get UIWebView to work properly?

I have been searching around the web for a couple of days to find a tutorial on how to get UiWebView to work with the latest version of xcode.
So far all the newest tutorias tells me to control drag my UiWebView into the .h file, but it wont let me do that.
(First Picture) Showing the problem with control dragging.
http://i.imgur.com/TUGb5.png
Then I tried to manually write the code as seen in the tutorials.
(Second picture) Showing the manually written code.
http://i.imgur.com/iRbUF.png
But it still does not load, just just shows a blank white screen???
Many interwebs to the one that can help me! :)
What you need to do is have them both..
So follow these steps ..
Add a UIWebView to the view in Interface builder
Click and drag from the WebView to the #interface class and you will see a small pop up saying add Outlet
Now release the click ..and it will ask you to name the Outlet
After you have named it(let say mywebView ) ..change
[webView loadrequest:];
to
[mywebView loadrequest:];

Cannot add a UIDatePicker to an xib without generating an Internal Error

I am using xCode 4.0.2 and trying to create a view controller with an xib that contains a UIDatePicker. Whenever I try to drag a UIDatePicker object to the view in the xib I get an Internal Error alert. This is a universal app and I am using an xib targeted for the iPhone.
Has anyone else experienced this or have any suggestions on how to work around this problem?
For now I am going to work around it by adding the UIDatePicker to the view in code.
Also, when I click the Crash button in the alert I am not getting the Crash Reporter. Isn't the Crash Reporter supposed to come up automatically? If this is a bug, how can I otherwise report it?
Thanks,
John
if you are using the Xcode UI and it crashes, assuming you don't have any huge environmental problems, no disk space... etc, that is a bug; and you should report it to:
bugreport.apple.com